Remove Interface ID and implement the lid/sid methods in __get()
This commit is contained in:
@@ -22,10 +22,20 @@ use App\Interfaces\IDs;
|
||||
* + name : Account Name
|
||||
* + taxes : Taxes Applicable to this account
|
||||
*/
|
||||
class Account extends Model implements IDs
|
||||
class Account extends Model
|
||||
{
|
||||
use HasFactory,ScopeActive;
|
||||
|
||||
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),
|
||||
};
|
||||
}
|
||||
|
||||
/* STATIC */
|
||||
|
||||
/**
|
||||
@@ -54,18 +64,6 @@ class Account extends Model implements IDs
|
||||
->get();
|
||||
}
|
||||
|
||||
/* 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