backoffice first commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Preventivo;
|
||||
use App\Support\PreventivoPdf;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
|
||||
Route::get('/admin/preventivi/{preventivo}/pdf', function (Preventivo $preventivo) {
|
||||
if (! $preventivo->pdf_path || ! Storage::disk('local')->exists($preventivo->pdf_path)) {
|
||||
$preventivo->pdf_path = PreventivoPdf::genera($preventivo);
|
||||
$preventivo->save();
|
||||
}
|
||||
|
||||
return Storage::disk('local')->response(
|
||||
$preventivo->pdf_path,
|
||||
'preventivo-'.($preventivo->numero ?? $preventivo->id).'.pdf'
|
||||
);
|
||||
})->middleware(['auth'])->name('preventivi.pdf.show');
|
||||
Reference in New Issue
Block a user