This commit is contained in:
denisdulici
2018-06-02 16:53:02 +03:00
parent adc36b0202
commit 23dbc973a0
2 changed files with 15 additions and 2 deletions

View File

@ -16,9 +16,19 @@ class Login
*/
public function handle(ILogin $event)
{
// Set company id
// Get first company
$company = $event->user->companies()->first();
// Logout if no company assigned
if (!$company) {
auth()->logout();
flash(trans('auth.error.no_company'))->error();
return redirect('auth/login');
}
// Set company id
session(['company_id' => $company->id]);
// Save user login time