añadir nuevas funcionalidades
This commit is contained in:
@@ -6,9 +6,13 @@ use App\Jobs\ProcessDocumentOCR;
|
||||
use App\Models\Document;
|
||||
use App\Models\Project;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class DocumentController extends Controller
|
||||
{
|
||||
public $comments=[];
|
||||
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
@@ -56,7 +60,19 @@ class DocumentController extends Controller
|
||||
*/
|
||||
public function show(Document $document)
|
||||
{
|
||||
//
|
||||
$this->authorize('view', $document); // Si usas políticas
|
||||
|
||||
if (!Storage::exists($document->file_path)) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$document->url = Storage::url($document->file_path);
|
||||
|
||||
return view('documents.show', [
|
||||
'document' => $document,
|
||||
'versions' => $document->versions()->latest()->get(),
|
||||
'comments' => $this->comments,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user