invoice/bill label

This commit is contained in:
denisdulici
2017-12-11 10:03:58 +03:00
parent 9dec124834
commit 9d7ace396c
4 changed files with 62 additions and 28 deletions

View File

@ -9,10 +9,40 @@ class BillStatus extends Model
protected $table = 'bill_statuses';
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected $appends = ['label'];
/**
* Attributes that should be mass-assignable.
*
* @var array
*/
protected $fillable = ['company_id', 'name', 'code'];
/**
* Get the status label.
*
* @return string
*/
public function getLabelAttribute()
{
switch ($this->code) {
case 'paid':
$label = 'label-success';
break;
case 'partial':
case 'received':
$label = 'label-warning';
break;
default:
$label = 'bg-aqua';
break;
}
return $label;
}
}