I am not an expert in programming, I just deploy Laravel projects to the server, but I get errors after everything is deployed. I'm using Laravel Framework 6.20.5 I have a named route
Route::get('/destinations/{slug}/{category}', 'HomeController@destinationsDetailCategory')->name('home.destinationsDetailCategory');
These are my homestays/resources/views/partials/header.blade.php code :
@foreach( $headerDestination as $city )
<a class="d-block w-50 p-2 dropdown-item" href="{{ route('home.destinationsDetailCategory', [$city->slug, 'attraction'])}}">{{ $city->name }}</a>
@endforeach
. What is my error? Thank you!
I tried modifying the value of the $city->slug parameter to handle null values and added the null coalescing operator to provide a default value if the slug is null. My expectation was to avoid the 'Missing required parameters' error for the 'home.destinationsDetailCategory' route. However, what actually happened is that the error message still appears, and the generated URL does not match the expected one."
You can try this