Add the following routes to your routes/web.php file:

// Invoice Routes
Route::get('/invoice/{orderId}', [App\Http\Controllers\InvoiceController::class, 'view'])->name('invoice.view');
Route::get('/invoice/{orderId}/download', [App\Http\Controllers\InvoiceController::class, 'download'])->name('invoice.download');


INSTALLATION STEPS:

1. Install DomPDF for PDF generation (if not already installed):
   composer require barryvdh/laravel-dompdf

2. Add this to your config/app.php providers array (if using older Laravel version):
   Barryvdh\DomPDF\ServiceProvider::class,

3. Add this to your config/app.php aliases (if using older Laravel version):
   'PDF' => Barryvdh\DomPDF\Facade\Pdf::class,

4. Copy the invoice routes above to your routes/web.php file

5. Make sure Order model and orderItems relationship are properly configured

6. The invoice will be generated automatically when user clicks "Download Invoice" button
