Basic design created
This commit is contained in:
23
app/Providers/AuthCheckProvider.php
Normal file
23
app/Providers/AuthCheckProvider.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
class AuthCheckProvider {
|
||||
public function checkLoggedIn() : bool {
|
||||
if (!auth()->check()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$user = auth()->user();
|
||||
$tenant = app('tenant');
|
||||
return $user->active && $tenant->slug === $user->tenant;
|
||||
}
|
||||
|
||||
public function getUserRole() : ?string {
|
||||
if (!$this->checkLoggedIn()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return auth()->user()->user_role;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user