How to use a resource collection toArray and DB (without Eloquent)
问题 I have this query (in a repository, without using eloquent) : public function getUsersOfASchool($schoolId, $request) { $query = DB::table('school_users as su') ->join('users as u', 'u.id', 'su.user_id') ->where('su.school_id', $schoolId); $users = $query->paginate(); return $users; } I have this controller : try{ $users = $this->userRepository->getUsersOfASchool($school->id, $request->all()); } catch(\Exception $e) { return response()->json(['message'=>'Bad request '.$e->getMessage()], 400);