/** * @param $projectId * @param $fileId * @return array|\Symfony\Component\HttpFoundation\BinaryFileResponse */ public function showFile($projectId, $fileId) { $file = $this->service->getFile($projectId, $fileId); $filePath = $this->service->getFilePath($projectId, $fileId); $fileContent = file_get_contents($filePath); $fileContent64 = base64_encode($fileContent); return ['name' => $file->file, 'file' => $fileContent64, 'size' => filesize($filePath)]; }
/** * @param $id * @param $fileId * * @return array */ public function destroy($id, $fileId) { if (empty($id) or $this->projectService->checkProjectOwner($id) == false) { return ['error' => 'Access forbidden']; } return $this->service->destroy($id, $fileId); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { if (!$this->service->checkProjectOwner($id)) { return $this->erroMsgm("O usuário não é owner desse projeto"); } $this->service->delete($id); return ['error' => false, 'Arquivo deletado com sucesso']; }
/** * Remove the specified resource from storage. * * @param int $id * @param $idFile * @return Response */ public function destroy($id, $idFile) { try { if ($this->projectService->checkProjectPermissions($id) == false) { return ['error' => 'Access Forbidden']; } $this->service->delete($idFile); return ['error' => false, 'message' => 'Store file deleted']; } catch (ModelNotFoundException $ex) { return ['error' => true, 'message' => 'Store file error']; } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id, $idFile) { //$this->repository->delete($idFile); /* //if($this->service->checkProjectPermissions($id) == false){ if($this->service->checkProjectOwner($id) == false){ return ['error' => 'Access Forbidden']; } //return $this->service->delete($id); */ $this->service->delete($idFile); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $project = $this->repository->find($id); if ($project) { $files = $this->repository->skipPresenter()->find($id)->files; foreach ($files as $file) { $this->fileService->delete($id, $file->id); } if ($this->repository->delete($id)) { return ['success' => true]; } else { return ['success' => false]; } } else { return ['success' => false, 'msg' => "Project not found!"]; } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id, $idFile) { $this->service->delete($idFile); }
public function update(Request $request, $id) { return $this->service->update($request->all(), $id); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($projectId, $id) { $this->service->delete($id); return ['error' => false, 'Arquivo deletado com sucesso']; }
public function destroy($file_id) { return $this->service->delete($file_id); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id, $idFile) { $data = $request->all(); $data['project_id'] = $id; return $this->service->update($data, $idFile); }