2017-09-14 22:21:00 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models\Income;
|
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
use App\Abstracts\Model;
|
2017-09-14 22:21:00 +03:00
|
|
|
|
|
|
|
class InvoiceStatus extends Model
|
|
|
|
{
|
|
|
|
|
|
|
|
protected $table = 'invoice_statuses';
|
|
|
|
|
2017-12-11 10:03:58 +03:00
|
|
|
/**
|
|
|
|
* The accessors to append to the model's array form.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $appends = ['label'];
|
|
|
|
|
2017-09-14 22:21:00 +03:00
|
|
|
/**
|
|
|
|
* Attributes that should be mass-assignable.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $fillable = ['company_id', 'name', 'code'];
|
2017-12-11 10:03:58 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the status label.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getLabelAttribute()
|
|
|
|
{
|
|
|
|
switch ($this->code) {
|
|
|
|
case 'paid':
|
2019-11-16 10:21:14 +03:00
|
|
|
$label = 'success';
|
2017-12-11 10:03:58 +03:00
|
|
|
break;
|
2018-03-13 15:06:28 +03:00
|
|
|
case 'delete':
|
2019-11-16 10:21:14 +03:00
|
|
|
$label = 'danger';
|
2018-03-13 15:06:28 +03:00
|
|
|
break;
|
2017-12-11 10:03:58 +03:00
|
|
|
case 'partial':
|
|
|
|
case 'sent':
|
2019-11-16 10:21:14 +03:00
|
|
|
$label = 'warning';
|
2017-12-11 10:03:58 +03:00
|
|
|
break;
|
|
|
|
default:
|
2019-11-16 10:21:14 +03:00
|
|
|
$label = 'info';
|
2017-12-11 10:03:58 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $label;
|
|
|
|
}
|
2017-09-14 22:21:00 +03:00
|
|
|
}
|