66 lines
1.1 KiB
PHP
66 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace app\apis\model;
|
|
|
|
use support\Model;
|
|
|
|
/**
|
|
* ModelModel
|
|
*/
|
|
class ModelModel extends Model
|
|
{
|
|
/**
|
|
* The connection name for the model.
|
|
*
|
|
* @var string|null
|
|
*/
|
|
protected $connection = 'mysql';
|
|
|
|
/**
|
|
* The table associated with the model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'hs_model';
|
|
|
|
/**
|
|
* The primary key associated with the table.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $primaryKey = 'id';
|
|
|
|
/**
|
|
* Indicates if the model should be timestamped.
|
|
*
|
|
* @var bool
|
|
*/
|
|
public $timestamps = true;
|
|
|
|
/**
|
|
* 模型的数据字段的保存格式。
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $dateFormat = 'U';
|
|
|
|
/**
|
|
* 允许自动填充模型字段
|
|
*/
|
|
protected $fillable = [];
|
|
|
|
/**
|
|
* 不允许自动填充模型字段
|
|
*/
|
|
protected $guarded = [];
|
|
|
|
public function translation()
|
|
{
|
|
return $this->hasOne(ModelTranslationModel::class, 'model_id')->where('locale', locale());
|
|
}
|
|
|
|
public function brand()
|
|
{
|
|
return $this->belongsTo(BrandModel::class, 'brand_id', 'id');
|
|
}
|
|
} |