public function update(array $data, $id)
 {
     try {
         return $this->repository->update($data, $id);
     } catch (ValidatorException $ex) {
         return ['error' => true, 'message' => $ex->getMessageBag()];
     }
 }
 public function find($id)
 {
     try {
         return $this->repository->find($id);
     } catch (\Exception $e) {
         return ["error" => true, "message" => 'Registro não encontrado.', "messageDev" => $e->getMessage()];
     }
 }
 public function delete($id)
 {
     $entity = User::find($id);
     if (is_null($entity)) {
         return Errors::invalidId($id);
     }
     if (count($entity->memberOf) > 0) {
         return Errors::basic("Este usuário participa de projetos. Exclusão cancelada.");
     }
     $this->repository->delete($id);
     return ['message' => "Registro deletado!"];
 }
 public function index()
 {
     return $this->repository->all();
 }
 /**
  * Search user informations.
  *
  * @return mixed
  */
 public function authenticated()
 {
     $userId = Authorizer::getResourceOwnerId();
     return $this->repository->find($userId);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     return $this->repository->skipPresenter()->find($id);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $limit = $request->query->get('limit', 15);
     return $this->userRepository->paginate($limit);
 }