Remove Interface ID and implement the lid/sid methods in __get()
This commit is contained in:
@@ -20,7 +20,7 @@ use App\Traits\SiteID;
|
||||
* Attributes for users:
|
||||
* + role : User's role
|
||||
*/
|
||||
class User extends Authenticatable implements IDs
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasFactory,HasApiTokens,Notifiable,UserSwitch,ScopeActive,SiteID;
|
||||
|
||||
@@ -63,6 +63,16 @@ class User extends Authenticatable implements IDs
|
||||
'customer',
|
||||
];
|
||||
|
||||
public function __get($key): mixed
|
||||
{
|
||||
return match ($key) {
|
||||
'lid' => sprintf('#%04s',$this->id),
|
||||
'sid' => sprintf('%02s-%s',$this->site_id,$this->lid),
|
||||
|
||||
default => parent::__get($key),
|
||||
};
|
||||
}
|
||||
|
||||
/* OVERRIDES */
|
||||
|
||||
/**
|
||||
@@ -76,18 +86,6 @@ class User extends Authenticatable implements IDs
|
||||
->onQueue('user'));
|
||||
}
|
||||
|
||||
/* INTERFACES */
|
||||
|
||||
public function getLIDAttribute(): string
|
||||
{
|
||||
return sprintf('#%04s',$this->id);
|
||||
}
|
||||
|
||||
public function getSIDAttribute(): string
|
||||
{
|
||||
return sprintf('%02s-%s',$this->site_id,$this->getLIDAttribute());
|
||||
}
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user