In laravel 5.5, I have created a middleware that sets the database connection for a tenant. I use that middleware in a route group like so.
Route::group(['domain' => '{site}.kyinfosysteem.loc', 'middleware' => 'association'], function() {
Route::get('/', function ($site) {
return view('welcome');
});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
});
What happens now, is that the /home
route runs the default auth middleware before my association one. This causes auth to fail, because it is trying to use the master database, which does not have a users table. How could i set the auth middleware to run after mine? Tried removing auth from the construct of HomeController
and doing this:
Route::group(['domain' => '{site}.kyinfosysteem.loc', 'middleware' => 'association'], function() {
Route::get('/', function ($site) {
return view('welcome');
});
Auth::routes();
Route::group(['middleware' => 'auth'], function() {
Route::get('/home', 'HomeController@index')->name('home');
});
});
but that does nothing...
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire