54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace app\ticket\model;
|
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use support\Model;
|
|
|
|
/**
|
|
* ticket_categorie 工单分类表
|
|
* @property integer $id 主键
|
|
* @property string $name 分类名称
|
|
* @property string $description 分类描述
|
|
* @property string $created_at 创建时间
|
|
* @property string $updated_at 更新时间
|
|
* @property string $deleted_at 删除时间
|
|
*/
|
|
class Categorie extends Model
|
|
{
|
|
use SoftDeletes;
|
|
protected $connection = 'mysql';
|
|
protected $table = 'tkt_ticket_categorie';
|
|
protected $primaryKey = 'id';
|
|
public $timestamps = true;
|
|
protected $dateFormat = 'U';
|
|
protected $dates = ['created_at', 'updated_at'];
|
|
protected $casts = [
|
|
'updated_at' => 'datetime:Y-m-d H:i:s',
|
|
'created_at' => 'datetime:Y-m-d H:i:s',
|
|
];
|
|
protected $fillable = [
|
|
'name',
|
|
'description',
|
|
];
|
|
|
|
/**
|
|
* 单条翻译
|
|
*/
|
|
public function translation()
|
|
{
|
|
return $this->hasOne(CategorieTranslation::class, 'categorie_id')->where('locale', locale());
|
|
}
|
|
|
|
/**
|
|
* 多条翻译
|
|
*/
|
|
public function translations()
|
|
{
|
|
return $this->hasMany(CategorieTranslation::class, 'categorie_id');
|
|
}
|
|
|
|
public function ticket(){
|
|
return $this->hasOne(Ticket::class, 'categorie_id', 'id');
|
|
}
|
|
}
|