Is it possible that a different Route is being matched? What does the full routes file look like?
Jan 30, 2023
2
Level 14
404 error even tho the route exist
Hi, I can't figure out why my route is not working. I always get 404 error when trying to access it, I have tried php artisan route:clear, php artisan optimize:clear and php artisan cache:clear but nothing changes.
Here is the route I'm trying to visit (I can see the route when I run php artisan route:list)
Route::get('/test/mail', function () {
$booking = Rental::where('id', 3)->with([
'car',
'customer',
'drivers',
'price',
'packages',
'insurances',
'extras'
])->firstOrFail();
Mail::to($booking->customer->email_address)->send(new BookingConfirmed($booking));
return "Hallo world";
});
Level 102
Most likely you dont have a Rental with id 3.
Change firstOrFail to first and dd($booking). If its null, there is no such rental. If you are 100% sure there is one in the database, you might have a global scope set on the Rental model
1 like
Please or to participate in this conversation.