DONE: use flexible name for api call in frontend

This commit is contained in:
ISMAIL MASSERAN
2026-08-09 10:18:26 +08:00
parent 1f8642e230
commit be96576f3d
102 changed files with 523 additions and 146 deletions
+12
View File
@@ -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';
}
}