Beispiel #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param UploadMediaRequest $request
  * @return Response
  */
 public function store(UploadMediaRequest $request)
 {
     $savedFile = $this->fileService->store($request->file('file'));
     if (is_string($savedFile)) {
         return Response::json(['error' => $savedFile], 409);
     }
     event(new FileWasUploaded($savedFile));
     return Response::json($savedFile->toArray());
 }
Beispiel #2
0
 public function addImages(Module $module, Request $request)
 {
     $savedFile = $this->fileService->store($request->file('file'));
     $module->files()->attach($savedFile->id, ['imageable_type' => get_class($module), 'zone' => $request->get('zone')]);
 }