function ($query) { $query->select('id', 'first_name','last_name', 'email'); // Specify the columns you want from the User model }]) ->select('id', 'principal_xid', 'rating') // Specify the columns you want from the UserRating model ->get() ->toArray(); return view('Admin.Pages.user_rating.user_ratings')->with(['user_rate' => $user_rating]); } }