public function showFile($id) { if (!$this->service->checkProjectPermissions($id)) { return $this->erroMsgm("O usuário não tem acesso a esse projeto"); } $filePath = $this->service->getFilePath($id); $fileContent = file_get_contents($filePath); $file64 = base64_encode($fileContent); return ['file' => $file64, 'size' => filesize($filePath), 'name' => $this->service->getFileName($id)]; }
/** * Remove the specified resource from storage. * * @param int $id * @param $filetId * @return Response */ public function destroy($id) { try { if ($this->service->checkProjectPermissions($id) == false) { return ['error' => 'Access Forbidden']; } $this->service->delete($id); return ['error' => false, 'message' => 'Store file deleted']; } catch (ModelNotFoundException $ex) { return ['error' => true, 'message' => 'Store file error']; } }