Some order processing
This commit is contained in:
@@ -22,6 +22,7 @@ class Service extends Model
|
||||
|
||||
protected $appends = [
|
||||
'account_name',
|
||||
'admin_service_id_url',
|
||||
'category',
|
||||
'name',
|
||||
'next_invoice',
|
||||
@@ -33,6 +34,7 @@ class Service extends Model
|
||||
|
||||
protected $visible = [
|
||||
'account_name',
|
||||
'admin_service_id_url',
|
||||
'active',
|
||||
'category',
|
||||
'data_orig',
|
||||
@@ -99,6 +101,11 @@ class Service extends Model
|
||||
return $this->account->company;
|
||||
}
|
||||
|
||||
public function getAdminServiceIdUrlAttribute()
|
||||
{
|
||||
return sprintf('<a href="/a/service/%s">%s</a>',$this->id,$this->service_id);
|
||||
}
|
||||
|
||||
public function getCategoryAttribute()
|
||||
{
|
||||
return $this->product->category;
|
||||
@@ -162,6 +169,19 @@ class Service extends Model
|
||||
return $this->active OR ($this->order_status AND ! in_array($this->order_status,$this->inactive_status));
|
||||
}
|
||||
|
||||
public function nextStatus() {
|
||||
switch ($this->order_status)
|
||||
{
|
||||
case 'ORDER-REQUEST':
|
||||
$this->order_status = 'ORDER-SENT';
|
||||
$this->save();
|
||||
return $this;
|
||||
|
||||
default:
|
||||
abort(500,'Next Status not set up for:'.$this->order_status);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will return the associated service model for the product type
|
||||
*/
|
||||
|
Reference in New Issue
Block a user