Created
October 21, 2017 14:55
-
-
Save laalex/acfb2c0699749e973d16b2d564336507 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* index | |
* | |
* @description List product groups | |
* @return mixed | |
*/ | |
public function index(Request $request, User $user) | |
{ | |
if (false === is_null($request->id)) { | |
$userEntry = $user::with('role', 'agencies')->find($request->id); | |
if (false === is_null($userEntry)) { | |
return toJson($userEntry); | |
} else { | |
return jsonError([ | |
'error' => 'user_entity_not_found', | |
'message' => 'Utilizatorul nu a fost gasit in baza de date', | |
'entry' => $request->id | |
]); | |
} | |
} | |
return toJson($user::with('role', 'agencies')->get()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment