Initial commit
This commit is contained in:
21
app/Http/Controllers/DocumentController.php
Normal file
21
app/Http/Controllers/DocumentController.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user