After installing and configuring stancl/tenancy package on an existing project, I chose to go with Path Identification to know which tenants should be set, and tried adding routes like so :
routes\tenant.php :
Route::group([
'prefix' => '/{tenant}',
'middleware' => [
InitializeTenancyByPath::class,
],
], function () {
Route::get('/', function () { // this route works fine
return 'This is your multi-tenant application. The id of the current tenant is ' . tenant('id');
});
Route::group([
'namespace' => 'App\Http\Controllers\Admin',
'prefix' => 'admin',
'middleware' => ['auth'],
], function () { // these routes throw the same error as the one shown below
Route::resource('user', 'UserController');
Route::resource('role', 'RoleController');
Route::resource('permission', 'PermissionController');
Route::get('edit-account-info', 'UserController@accountInfo')->name('admin.account.info');
Route::post('edit-account-info', 'UserController@accountInfoStore')->name('admin.account.info.store');
Route::post('change-password', 'UserController@changePasswordStore')->name('admin.account.password.store');
});
});
However, when accessing this route /foo/admin/user, the following error occured:
Missing required parameter for [Route: user.index] [URI: {tenant}/admin/user] [Missing parameter: tenant]. (View: /path/to/project-placeholder/resources/views/layouts/navigation.blade.php)

I'm not sure what is happening here. It could be that my auth middleware has no idea about this 'tenant' parameter.
Any Ideas ?