backoffice first commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\Api\CarrelloController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
// Espone al configuratore l'URL corrente dell'app cliente (checkout), così il
|
||||
// frontend non deve indovinare la porta su cui gira Vite (può cambiare se 5174 è occupata).
|
||||
Route::get('config', fn () => response()->json([
|
||||
'frontend_cliente_url' => config('preventivi.frontend_cliente_url'),
|
||||
]));
|
||||
|
||||
Route::prefix('carrello')->group(function () {
|
||||
Route::post('aggiungi', [CarrelloController::class, 'aggiungi']);
|
||||
Route::get('{token}', [CarrelloController::class, 'mostra']);
|
||||
Route::delete('{token}/item/{item}', [CarrelloController::class, 'rimuoviItem']);
|
||||
Route::post('{token}/conferma', [CarrelloController::class, 'conferma']);
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
@@ -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