Я создал 2 (две) системы и 2 поддомена с той же базой данных но сотрудники могут входить в обе системы, и я хочу отключить персонал, чтобы они не входили в другую систему.
пожалуйста, дайте мне знать, если кто-нибудь сможет это сделать. Я новичок в мире Laravel
Спасибо
разрешение + роли + промежуточное ПО.






Рассмотрите возможность добавления поля instance_id к модели User.
В первом приложении добавьте в app/Http/Controllers/Auth/LoginController.php:
/**
* Attempt to log the user into the application.
*
* @param \Illuminate\Http\Request $request
* @return bool
*/
protected function attemptLogin(Request $request)
{
$success = $this->guard()->attempt(
$this->credentials($request), $request->filled('remember')
);
return ($success && $this->userExistsInApplication());
}
/**
* Determine if the user exists for the specified application
*
* @return bool
*/
private function userExistsInApplication()
{
if ($this->guard()->user()->instance_id == env('APP_INSTANCE'))
return true;
$this->guard()->user()->logout();
return false;
}
Добавить в .env:
APP_INSTANCE=1
В приложении второй добавьте в app/Http/Controllers/Auth/LoginController.php:
/**
* Attempt to log the user into the application.
*
* @param \Illuminate\Http\Request $request
* @return bool
*/
protected function attemptLogin(Request $request)
{
$success = $this->guard()->attempt(
$this->credentials($request), $request->filled('remember')
);
return ($success && $this->userExistsInApplication());
}
/**
* Determine if the user exists for the specified application
*
* @return bool
*/
private function userExistsInApplication()
{
if ($this->guard()->user()->instance_id == env('APP_INSTANCE'))
return true;
$this->guard()->user()->logout();
return false;
}
Добавить в .env:
APP_INSTANCE=2
Установите, в какой экземпляр пользователь может войти, на основе их значения, установленного в instance_id.
Вы можете использовать два промежуточного программного обеспечения: одно для персонала, а другое для администратора. Если вы не имеете представления о промежуточном программном обеспечении, прочтите эту ссылку laravel.com/docs/5.4/middleware