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

@@ -65,7 +65,7 @@ use App\Traits\{ScopeAccountUserAuthorised,ScopeServiceActive,SiteID};
* + sid : System ID for service
* + supplied : The model of the supplier's product used for this service.
*/
class Service extends Model implements IDs
class Service extends Model
{
use HasFactory,ScopeAccountUserAuthorised,ScopeServiceActive,SiteID;
@@ -313,6 +313,9 @@ class Service extends Model implements IDs
'is_pending_change' => $this->active && $this->changes()->where('service__change.active',TRUE)->where('complete',FALSE)->count(),
'is_pending_cancel' => $this->active && in_array(strtolower($this->order_status),['cancel-request','cancel-pending']),
'lid' => sprintf('%05s',$this->id),
'sid' => sprintf('%02s-%04s.%s',$this->site_id,$this->account_id,$this->lid),
'status' => $this->active
? strtolower($this->order_status)
: ((strtolower($this->order_status) === 'cancelled') ? 'cancelled' : 'inactive'),
@@ -341,28 +344,6 @@ class Service extends Model implements IDs
->get();
}
/* INTERFACES */
/**
* Service Local ID
*
* @return string
*/
public function getLIDAttribute(): string
{
return sprintf('%05s',$this->id);
}
/**
* Services System ID
*
* @return string
*/
public function getSIDAttribute(): string
{
return sprintf('%02s-%04s.%s',$this->site_id,$this->account_id,$this->getLIDattribute());
}
/* RELATIONS */
/**