Penaf's avatar
Level 1

Pagination for 2 relations

Hello, Having 4 models where all include an id and a name

  • User
  • Author
  • Multimedia
  • Documents

I'm linking the User model to the Author model by the email field.

On the user profile I'm trying to display a count of all documents and multimedia that user submited as well as the last 10 multimediaand last 10 documents submitted (trying to do it with pagination or later if I see it's undoable I can link to a view where I show all images submitted)

Right now I have this (workd great)

        $user = Sentinel::getUser();

        $autor = Autor::where('email', 'LIKE', $user->email)
            ->with(['multimedia', 'documento'])
            ->withCount(['multimedia', 'documento'])
            ->first();


        return view('perfil', compact('user', 'autor'));

My question is this, is it possible to have double pagination in the same view ? How can I query for only 10 multimedias and 10 documents max to display on the view ?

As always, thanks for the incredible help you never fail to provide!

0 likes
2 replies
Penaf's avatar
Level 1

@JLRDW - Perfect! Thanks for pointing me the best direction!

1 like

Please or to participate in this conversation.