Ejemplo n.º 1
0
 public function createFile(array $data)
 {
     $project = $this->repository->skipPresenter()->find($data['project_id']);
     // dd($project);
     $projectFile = $project->files()->create($data);
     $this->storage->put($projectFile->id . "." . $data['extension'], $this->filesystem->get($data['file']));
 }
Ejemplo n.º 2
0
 /**
  * @param $id
  * @param array $with
  * @return array|mixed
  */
 public function show($id, $with = [])
 {
     try {
         return $this->repository->skipPresenter()->with($with)->find($id);
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'No data found for id:' . $id];
     }
 }
Ejemplo n.º 3
0
 public function destroy($id)
 {
     try {
         $this->repository->skipPresenter()->find($id)->delete();
         return ['deleted' => 'true'];
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'No data found for id:' . $id];
     } catch (QueryException $e) {
         return ['error' => true, 'message' => 'You cannot delete this data, there is register related!'];
     }
 }