relocating
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Order;
|
||||
use App\Services\InvoiceService;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
// Test route to generate and view an invoice
|
||||
// Usage: http://localhost:8000/test-invoice/{order_number}
|
||||
Route::get('/test-invoice/{orderNumber}', function ($orderNumber) {
|
||||
$order = Order::where('order_number', $orderNumber)->first();
|
||||
|
||||
if (!$order) {
|
||||
return response()->json(['error' => 'Order not found'], 404);
|
||||
}
|
||||
|
||||
try {
|
||||
// Generate invoice
|
||||
$invoicePath = InvoiceService::generateInvoice($order);
|
||||
|
||||
// Get the full path from public disk
|
||||
$fullPath = storage_path('app/public/' . $invoicePath);
|
||||
|
||||
Log::info('Invoice test:', [
|
||||
'order_number' => $orderNumber,
|
||||
'stored_path' => $invoicePath,
|
||||
'full_path' => $fullPath,
|
||||
'file_exists' => file_exists($fullPath),
|
||||
]);
|
||||
|
||||
if (file_exists($fullPath)) {
|
||||
return response()->file($fullPath);
|
||||
} else {
|
||||
return response()->json([
|
||||
'error' => 'Invoice file not found',
|
||||
'path' => $invoicePath,
|
||||
'full_path' => $fullPath,
|
||||
], 500);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Invoice test error:', [
|
||||
'order_number' => $orderNumber,
|
||||
'error' => $e->getMessage(),
|
||||
'trace' => $e->getTraceAsString(),
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'error' => 'Failed to generate invoice',
|
||||
'message' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
})->name('test-invoice');
|
||||
@@ -39,6 +39,10 @@ Route::post('/orders/process', [OrderController::class, 'process'])->name('order
|
||||
Route::get('/orders/success/{order:uuid}', [OrderController::class, 'success'])->name('order-success');
|
||||
Route::get('/orders/history', [OrderController::class, 'history'])->name('order-history');
|
||||
|
||||
// Guest order tracking routes
|
||||
Route::get('/track-order', [OrderController::class, 'trackForm'])->name('track-order-form');
|
||||
Route::post('/track-order', [OrderController::class, 'trackSearch'])->name('track-order-search');
|
||||
|
||||
// Yoco payment routes
|
||||
Route::get('/payment/yoco/{order:uuid}', [OrderController::class, 'yocoPayment'])->name('yoco-payment');
|
||||
Route::get('/payment/yoco/success/{order:uuid}', [OrderController::class, 'yocoSuccess'])->name('yoco-success');
|
||||
@@ -59,3 +63,15 @@ Route::middleware('auth')->group(function () {
|
||||
Route::get('/payment/yoco/custom/deposit/success/{customOrder:uuid}', [CustomOrderController::class, 'depositSuccess'])->name('yoco-custom-deposit-success');
|
||||
});
|
||||
|
||||
// use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/font-test', function () {
|
||||
dd(
|
||||
file_exists(storage_path('fonts/AbrilFatface-Regular.ttf')),
|
||||
is_readable(storage_path('fonts/AbrilFatface-Regular.ttf'))
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
// Test route for invoice generation (remove in production)
|
||||
require __DIR__ . '/test-invoice.php';
|
||||
Reference in New Issue
Block a user