/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { if ($this->service->checkProjectPermission($id) == false) { return ['error' => 'Acesso negado ao projeto!']; } $this->repository->skipPresenter()->find($id)->delete(); }
public function create(array $data) { try { $this->validator->with($data)->passesOrFail(); $project = $this->projectRepository->skipPresenter()->find($data['project_id']); $projectFile = $project->files()->create($data); $this->storage->put($projectFile->id . "." . $data['extension'], $this->fileSystem->get($data['file'])); return $projectFile; } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } }