/** * @param null $action * * @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed */ public function register($action = null) { switch ($action) { case 'info': return $this->widgetInformation(); default: $user = $this->r_user->find(Auth::user()->id); return $this->output('users.widgets.profileusers', ['user' => $user]); } }
/** * $> curl --header "X-Authorization: <API_KEY>" * http://localhost/api/v1/users/<ID> * * @route api/v1/users * @type GET * * @param $id * * @return mixed */ public function show($id) { $users = []; try { if (Auth::user()->hasRole('admin')) { $users = $this->r_users->find($id); } return $this->response->withItem($users, new $this->obj_userTransformer()); } catch (ModelNotFoundException $e) { return $this->response->errorNotFound(); } }