55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
class Calculation extends SigdModel
|
|
{
|
|
protected $table = 'calculation';
|
|
protected $fillable = [
|
|
'id',
|
|
'inventory_year',
|
|
'energy',
|
|
'agriculture',
|
|
'folu',
|
|
'waste',
|
|
'ippu',
|
|
'calculation_status',
|
|
'executed_time',
|
|
'finished_time',
|
|
'row_status',
|
|
'created_by',
|
|
'updated_by'
|
|
];
|
|
|
|
protected $casts = [
|
|
'executed_time' => 'datetime',
|
|
'finished_time' => 'datetime',
|
|
];
|
|
|
|
public function getSectorAttribute()
|
|
{
|
|
$tags = [];
|
|
|
|
// $badgeStyle = 'font-size: 10px; padding: 8px;';
|
|
$badgeStyle = '';
|
|
|
|
if ($this->energy) {
|
|
$tags[] = '<span class="badge badge-info" style="margin:1px; ' . $badgeStyle . '">ENERGI</span>';
|
|
}
|
|
if ($this->agriculture) {
|
|
$tags[] = '<span class="badge badge-info" style="margin:1px; ' . $badgeStyle . '">PERTANIAN</span>';
|
|
}
|
|
if ($this->folu) {
|
|
$tags[] = '<span class="badge badge-info" style="margin:1px; ' . $badgeStyle . '">LAHAN</span>';
|
|
}
|
|
if ($this->waste) {
|
|
$tags[] = '<span class="badge badge-info" style="margin:1px; ' . $badgeStyle . '">LIMBAH</span>';
|
|
}
|
|
if ($this->ippu) {
|
|
$tags[] = '<span class="badge badge-info" style="margin:1px; ' . $badgeStyle . '">IPPU</span>';
|
|
}
|
|
|
|
return implode(' ', $tags);
|
|
}
|
|
}
|