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,7 +22,7 @@ use App\Traits\{ProviderRef,PushNew,ScopeAccountUserAuthorised,SiteID};
*
* @package App\Models
*/
class Payment extends Model implements IDs
class Payment extends Model
{
use ProviderRef,PushNew,ScopeActive,ScopeAccountUserAuthorised,SiteID;
@@ -36,26 +36,14 @@ class Payment extends Model implements IDs
// Any balance below this we'll assume its all used.
private const threshold = 0.05;
/* INTERFACES */
/**
* Payment Local ID
*
* @return string
*/
public function getLIDattribute(): string
public function __get($key): mixed
{
return sprintf('%06s',$this->id);
}
return match ($key) {
'lid' => sprintf('%06s',$this->id),
'sid' => sprintf('%02s-%04s#%s',$this->site_id,$this->account_id,$this->lid),
/**
* Payment System ID
*
* @return string
*/
public function getSIDAttribute(): string
{
return sprintf('%02s-%04s#%s',$this->site_id,$this->account_id,$this->getLIDattribute());
default => parent::__get($key),
};
}
/* RELATIONS */