You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, when I click on a link that requires a model bind (eg. Route::get('customers/{customer}', 'CustomerController@show')) I get the error "App\Http\Controllers\Customers\CustomerController::show(): Argument #1 ($customer) must be of type App\Models\Customer, string given"
So it seems that $subdomain is used instead of the id.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Version: 11.20.0
PHP Version: 8.3.7
Database Version: MySQL 8.0.39
Hi,
I'm trying to create a multitenant application based on subdomain.
Routes are grouped by domain:
I created a middleware that sets database, root for filesystem and sets default parameter:
I added the middleware in bootstrap\app.php:
So far everything works fine.
However, when I click on a link that requires a model bind (eg. Route::get('customers/{customer}', 'CustomerController@show')) I get the error "App\Http\Controllers\Customers\CustomerController::show(): Argument #1 ($customer) must be of type App\Models\Customer, string given"
So it seems that $subdomain is used instead of the id.
As specified in the guide here:
https://laravel.com/docs/11.x/urls#url-defaults-middleware-priority
I tried to set the middleware priority by setting it before SubstituteBindings but the problem remains:
To set the priority is it enough to indicate the two middleware involved?
Should I use the append method or does this not use the set priority?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions