Skip to content

Instantly share code, notes, and snippets.

@laalex
Created October 21, 2017 14:55
Show Gist options
  • Save laalex/acfb2c0699749e973d16b2d564336507 to your computer and use it in GitHub Desktop.
Save laalex/acfb2c0699749e973d16b2d564336507 to your computer and use it in GitHub Desktop.
/**
* 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