29 lines
782 B
PHP
29 lines
782 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Client;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Medium;
|
|
use App\Services\Document\CaseService;
|
|
use App\Services\FileStorageService;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class MediaController extends Controller
|
|
{
|
|
protected CaseService $caseService;
|
|
protected FileStorageService $fileStorageService;
|
|
|
|
public function __construct(CaseService $caseService, FileStorageService $fileStorageService)
|
|
{
|
|
$this->caseService = $caseService;
|
|
$this->fileStorageService = $fileStorageService;
|
|
}
|
|
|
|
public function download(Medium $medium)
|
|
{
|
|
abort_unless($this->caseService->canAccessMedium($medium, Auth::user()), 403);
|
|
|
|
return $this->fileStorageService->downloadFile($medium);
|
|
}
|
|
}
|