BillStatus.php
998 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace App\Models\Expense;
use App\Models\Model;
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 'delete':
$label = 'label-danger';
break;
case 'partial':
case 'received':
$label = 'label-warning';
break;
default:
$label = 'bg-aqua';
break;
}
return $label;
}
}