70 lines
1.8 KiB
PHP
70 lines
1.8 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class Status
|
|
*
|
|
* @property int $id
|
|
* @property string $name
|
|
* @property int $handling_days
|
|
* @property string $color
|
|
* @property Collection|Lead[] $leads
|
|
* @property Collection|StatusHistory[] $status_histories
|
|
* @package App\Models
|
|
* @property-read int|null $leads_count
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status whereColor($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status whereHandlingDays($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Status whereName($value)
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Status extends Model
|
|
{
|
|
protected $connection = 'mysql';
|
|
|
|
protected $table = 'status';
|
|
|
|
public $timestamps = false;
|
|
|
|
protected $casts = [
|
|
'handling_days' => 'int'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'handling_days',
|
|
'color'
|
|
];
|
|
|
|
|
|
public function getStatusBadge()
|
|
{
|
|
$color = $this->color;
|
|
$icon = "";
|
|
|
|
if($this->id == 14){
|
|
$icon = '<i class="fa fa-times-circle"></i> ';
|
|
}
|
|
if($this->id == 15){
|
|
$icon = '<i class="fa fa-balance-scale"></i> ';
|
|
|
|
}
|
|
return '<span data-order="'.$this->id.'"><span class="badge badge-dark" style="background-color: '.$color.'">'.$icon.$this->name.'</span></span>';
|
|
}
|
|
|
|
/*public function status_histories()
|
|
{
|
|
return $this->hasMany(StatusHistory::class);
|
|
}*/
|
|
}
|