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!!!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire