itstructure /
laravel-media-file-uploader
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Itstructure\MFU\Http\Controllers; |
||
| 4 | |||
| 5 | use Illuminate\Support\Facades\Storage; |
||
| 6 | use Itstructure\MFU\Models\Mediafile; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Class DownloadController |
||
| 10 | * @package Itstructure\MFU\Http\Controllers |
||
| 11 | */ |
||
| 12 | class DownloadController extends BaseController |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @param int $id |
||
| 16 | * @return \Symfony\Component\HttpFoundation\StreamedResponse |
||
| 17 | */ |
||
| 18 | public function download(int $id) |
||
| 19 | { |
||
| 20 | $fileModel = Mediafile::find($id); |
||
| 21 | return Storage::disk($fileModel->disk)->download($fileModel->path, $fileModel->file_name); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 22 | } |
||
| 23 | } |
||
| 24 |