public function show($id) { try { return $this->repository->with(['client', 'owner', 'notes'])->find($id); } catch (ModelNotFoundException $e) { return ['error' => true, 'message' => 'projeto não encontrado']; } }
public function index() { return $this->repository->with(['client', 'owner', 'notes'])->all(); //$this->repository->pushCriteria(new ProjectCriteria()); // $arrProjetos = $this->repository->skipPresenter()->scopeQuery(function($query){ // return $query->select('id','client_id','name') // ->join('project_members', 'project_members.project_id', '=', 'id') // ->where('status', '=', 'F') // ->where('project_members.user_id', '=', '1') // ->orderBy('id','ASC'); // })->all(); // return $arrProjetos; // $arrayProjetos = array(); // foreach ($arrProjetos as $key => $array) { // foreach ($array as $elemento) { // $arrayProjetos[$elemento["project_id"]] = $elemento; // } // } // view('project.projects', ['projetos' => $arrProjetos]); }