vendredi 29 mai 2020

Where can i put the paginate()

I am trying put the paginate(10), to add a pagination later, put when i put give me this error:

Undefined property: Illuminate\Pagination\LengthAwarePaginator::$product

Here my controller here i want add the pagination(10):

 public function index()
    {
        $user_id = auth()->user()->id;
        $user = User::find($user_id);

        return view('your')->with('product', $user->product);
    }

I did try this:

 public function index()
    {
        $user_id = auth()->user()->id;
        $user = User::find($user_id)->paginate(10);

        return view('your')->with('product', $user->product);
    }

Thanks for you help!!!



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3erL884
via IFTTT

Aucun commentaire:

Enregistrer un commentaire