public function viewAbstract ( ) { // Retrieve all abstracts associated with the authenticated user $abstracts = Paper :: where ( 'user_id' , auth ()-> user ()->id)-> get (); // Preprocess authors $authors = Author :: whereIn ( 'paper_id' , $abstracts -> pluck ( 'id' ))-> get ()-> groupBy ( 'paper_id' ); // Pass both abstracts and authors to the view return view ( 'paper.view_abstracts' , compact ( 'abstracts' , 'authors' )); } Retrieve Abstracts : We retrieve all abstracts associated with the authenticated user from the papers table using Eloquent ORM. The where('user_id', auth()->user()->id) condition filters the abstracts by the user's ID. Preprocess Authors : We preprocess the authors associated with the retrieved abstracts. First, we extract the IDs of the abstracts using $abstracts->pluck('id') . Then, we use whereIn('paper_id', ...) to retrieve ...