app/Http/Controllers/ItemController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
      $currentUser = User::find(auth()->user()->id);
      $itemsReturned = $currentUser->itemsOwned->where('state_id', 4);
      $itemsForMe = $currentUser->itemsLent->where('state_id', 2);
      $myItems = $currentUser->itemsOwned;
      $lentItems = $currentUser->itemsLent->where('state_id', 3);
      $timeNow = Carbon::now()->toDateTimeString();
      $data = array(
        'myItems' => $myItems,
        'lentItems' => $lentItems,
        'timeNow' => $timeNow,
        'itemsForMe' => $itemsForMe,
        'itemsReturned' => $itemsReturned,
      );
      return view('items.index')->with($data);
    }
public function index ( ) { $ currentUser = User :: find ( auth ( ) -> user ( ) -> id ) ; $ itemsReturned = $ currentUser -> itemsOwned -> where ( 'state_id' , 4 ) ; $ itemsForMe = $ currentUser -> itemsLent -> where ( 'state_id' , 2 ) ; $ myItems = $ currentUser -> itemsOwned ; $ lentItems = $ currentUser -> itemsLent -> where ( 'state_id' , 3 ) ; $ timeNow = Carbon :: now ( ) -> toDateTimeString ( ) ; $ data = array ( 'myItems' => $ myItems , 'lentItems' => $ lentItems , 'timeNow' => $ timeNow , 'itemsForMe' => $ itemsForMe , 'itemsReturned' => $ itemsReturned , ) ; return view ( 'items.index' ) -> with ( $ data ) ; }
Display a listing of the resource.
Display a listing of the resource .