feat: implement media download functionality and enhance case handling in reports
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user