file('file'); $path = Storage::putFile('media', $file); return File::create([ 'user_id' => auth()->id(), 'disk' => config('filesystems.default'), 'filename' => $file->getClientOriginalName(), 'path' => $path, 'extension' => $file->guessClientExtension() ?? '', 'mime' => $file->getClientMimeType(), 'size' => $file->getSize(), ]); } /** * Remove the specified resources from storage. * * @param string $ids * @return \Illuminate\Http\Response */ public function destroy($ids) { File::find(explode(',', $ids))->each->delete(); } }