Files
fdesk/app/ticket/model/Categorie.php
T

54 lines
1.3 KiB
PHP
Raw Normal View History

2025-07-04 13:45:50 +08:00
<?php
namespace app\ticket\model;
2025-07-04 14:38:00 +08:00
use Illuminate\Database\Eloquent\SoftDeletes;
2025-07-04 13:45:50 +08:00
use support\Model;
/**
* ticket_categorie 工单分类表
* @property integer $id 主键
* @property string $name 分类名称
* @property string $description 分类描述
* @property string $created_at 创建时间
* @property string $updated_at 更新时间
2025-07-04 14:38:00 +08:00
* @property string $deleted_at 删除时间
2025-07-04 13:45:50 +08:00
*/
2025-07-04 15:04:29 +08:00
class Categorie extends Model
2025-07-04 13:45:50 +08:00
{
2025-07-04 14:38:00 +08:00
use SoftDeletes;
2025-07-04 13:45:50 +08:00
protected $connection = 'mysql';
2025-07-07 15:27:48 +08:00
protected $table = 'tkt_ticket_categorie';
2025-07-04 13:45:50 +08:00
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()
{
2025-07-04 15:04:29 +08:00
return $this->hasOne(CategorieTranslation::class, 'categorie_id')->where('locale', locale());
2025-07-04 13:45:50 +08:00
}
/**
* 多条翻译
*/
public function translations()
{
2025-07-04 15:04:29 +08:00
return $this->hasMany(CategorieTranslation::class, 'categorie_id');
}
public function ticket(){
return $this->hasOne(Ticket::class, 'categorie_id', 'id');
2025-07-04 13:45:50 +08:00
}
}