src/Http/Controllers/HandleUploads.php
public function uploadFile(int $id, UploadRequest $request, UploadService $uploadService)
    {
        if(!$object = $this->repository->find($id)) {
            abort(404);
        }

        $file = $request->file('file');

        $media = $uploadService->upload($object, $file);

        \Cache::tags('response')->flush();

        return new MediaResource($media);
    }
public function uploadFile(int $id, UploadRequest $request, UploadService $uploadService)
    {
        if(!$object = $this->repository->find($id)) {
            abort(404);
        }

        $file = $request->file('file');

        $media = $uploadService->upload($object, $file);

        \Cache::tags('response')->flush();

        return new MediaResource($media);
    }
Upload file

@param int $id
@param UploadRequest $request
@param UploadService $uploadService
@return MediaResource