Remove Interface ID and implement the lid/sid methods in __get()

This commit is contained in:
2025-05-22 17:31:00 +10:00
parent a988720340
commit 1e496a2863
7 changed files with 47 additions and 124 deletions

View File

@@ -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 */
/**