22 lines
508 B
PHP
22 lines
508 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use App\Models\Document;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class DocumentController extends Controller
|
|
{
|
|
public function show(Document $document)
|
|
{
|
|
// Permission check is already handled by middleware in the route
|
|
if (!Storage::disk('local')->exists($document->file_path)) {
|
|
abort(404, 'File not found');
|
|
}
|
|
|
|
return Storage::disk('local')->response($document->file_path);
|
|
}
|
|
}
|