DONE: use flexible name for api call in frontend
This commit is contained in:
@@ -6,9 +6,11 @@ use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Lab404\Impersonate\Models\Impersonate;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Impersonate;
|
||||
use Notifiable;
|
||||
|
||||
protected $guard = 'web';
|
||||
@@ -43,4 +45,14 @@ class User extends Authenticatable
|
||||
{
|
||||
return $this->hasOne(Cawangan::class, 'kodcaw', 'cawangan');
|
||||
}
|
||||
|
||||
public function canImpersonate(): bool
|
||||
{
|
||||
return in_array($this->roles ?? '', ['admin'], true);
|
||||
}
|
||||
|
||||
public function canBeImpersonated(): bool
|
||||
{
|
||||
return ($this->roles ?? '') !== 'admin';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user