MIF_E31222691/routes/web.php

26 lines
693 B
PHP

<?php
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Storage;
use App\Http\Controllers\PdfViewController;
Route::get('/', function () {
return view('welcome');
});
Route::get('/view-pdf', [PdfViewController::class, 'show'])->name('pdf.view');
// Route untuk mengakses file PDF langsung
Route::get('/storage/berkas/{path}', function ($path) {
$fullPath = storage_path('app/berkas/' . $path);
if (!file_exists($fullPath)) {
abort(404);
}
return response()->file($fullPath, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'inline; filename="' . basename($path) . '"'
]);
})->where('path', '.*');