я делаю несколько сторожей в моем проекте только для тестирования, оба сторожа имеют одинаковые разрешения, но другой сторож не будет входить в систему
здесь auth.php
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'worker' => [
'driver' => 'session',
'provider' => 'workers',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
'workers' => [
'driver' => 'eloquent',
'model' => App\Worker::class,
],
и вот loginController
кстати loginattempt
работает я проверил
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
protected function attemptLogin(Request $request)
{
if(Auth::guard('web')->attempt($this->credentials($request), $request->filled('remember')))
return true;
elseif(Auth::guard('worker')->attempt($this->credentials($request),$request->filled('remember'))){
return true;
}
}
и вот мои веб-маршруты
Route::get('/', ['as' => 'album.index', 'uses' => 'AlbumController@index']);
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::group(['middleware' => 'auth'], function () {
Route::get('logout', 'Controller@customLogout')->name('customLogout');
Route::group(['prefix' => 'album'], function () {
Route::get('/showAllAlbums', ['as' => 'album.showAllAlbums', 'uses' => 'AlbumController@showAllAlbums']);
Route::get('create', ['as' => 'album.create', 'uses' => 'AlbumController@create']);
Route::post('create', ['as' => 'album.store', 'uses' => 'AlbumController@store']);
Route::get('/{id}', ['as' => 'album.show', 'uses' => 'AlbumController@show']);
Route::get('delete/{id}', ['as' => 'album.destroy', 'uses' => 'AlbumController@destroy']);
// upload Photos Routes
Route::get('/uploadPhoto/{id}', ['as' => 'photo.create', 'uses' => 'PhotoController@create']);
Route::post('/uploadPhoto', ['as' => 'photo.store', 'uses' => 'PhotoController@store']);
});
Route::group(['prefix' => 'photo'], function () {
Route::get('/{id}', ['as' => 'photo.show', 'uses' => 'PhotoController@show']);
Route::get('delete/{id}', ['as' => 'photo.destroy', 'uses' => 'PhotoController@destroy']);
});
});
Задача ещё не решена.
Других решений пока нет …