DownloadController::download()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
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
The property file_name does not seem to exist on Illuminate\Database\Eloq...gHasThroughRelationship.
Loading history...
Bug introduced by
The property disk does not seem to exist on Illuminate\Database\Eloq...gHasThroughRelationship.
Loading history...
Bug introduced by
The property path does not seem to exist on Illuminate\Database\Eloq...gHasThroughRelationship.
Loading history...
22
    }
23
}
24