/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id, $noteId) { if ($this->repository->skipPresenter()->find($noteId)->delete()) { return ['success' => true, 'message' => 'Nota ' . $noteId . ' excluída com sucesso!']; } return ['error' => true, 'message' => 'Não foi possível excluir a nota ' . $noteId]; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id, $noteId) { if ($this->projectService->checkProjectPermissions($id) == false) { return ['error' => 'Access forbidden']; } try { $projectNote = $this->repository->skipPresenter()->find($noteId); if (empty($projectNote)) { return ['error' => 'ProjectNote not found']; } $projectNote->delete(); } catch (\Exception $e) { return ['error' => $e->getMessage()]; } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $projectNote = $this->repository->skipPresenter()->find($id); //$result = $this->repository->delete($id); $projectId = $projectNote->project_id; if ($this->checkProjectNotePermissions($projectId) == false) { return ['error' => 'Access Forbidden']; } $result = $projectNote->delete(); if ($result) { return ['error' => 0]; } return ['error' => 1, 'msg' => 'Erro ao tentar deletar a Task Note']; /* $result = $this->repository->find($id)->delete(); if($result) return ['error' => 0]; return ['error' => 1, 'msg' => 'Erro ao tentar deletar o Projecte']; */ }
private function checkProjectOwner($projectId) { $userId = \Authorizer::getResourceOwnerId(); return $this->repository->skipPresenter()->isOwner($projectId, $userId); }
/** * Display a listing of the resource. * * @return Response */ public function index($id_project) { return $this->repository->skipPresenter()->findWhere(['project_id' => $id_project]); }
/** * @param $fileId * @return string */ public function getFilePath($fileId) { $file = $this->repository->skipPresenter()->find($fileId); return $this->getBaseUrl($file); }