/** * Display the specified resource. * * @param int $id * * @return \Illuminate\Http\Response */ public function show($id) { // Allow for both an id, or a name as an identifier $user = User::with('roles', 'keys', 'affiliations')->where(is_numeric($id) ? 'id' : 'name', $id)->first(); return response()->json($user); }
/** * @return mixed */ public function getAllUsersWithKeys() { $users = UserModel::with('keys.characters')->get(); return $users; }