广告位

This commit is contained in:
2025-07-08 14:17:38 +08:00
parent 33fa31829d
commit af8023db3b
19 changed files with 1031 additions and 2 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ class AdModel extends Model
/**
* 允许自动填充模型字段
*/
protected $fillable = ['id', 'image', 'status', 'sort', 'creater', 'created_at', 'updated_at'];
protected $fillable = ['id', 'adp_id', 'image', 'href', 'status', 'sort', 'creater', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
+72
View File
@@ -0,0 +1,72 @@
<?php
namespace app\console\model;
use support\Model;
/**
* AdpModel
*/
class AdpModel 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_adp';
/**
* 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 = ['id', 'status', 'sort', 'creater', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
/**
* 单条翻译
*/
public function translation()
{
return $this->hasOne(AdpTranslationModel::class, 'adp_id')->where('locale', locale());
}
/**
* 多条翻译
*/
public function translations()
{
return $this->hasMany(AdpTranslationModel::class, 'adp_id');
}
}
+56
View File
@@ -0,0 +1,56 @@
<?php
namespace app\console\model;
use support\Model;
/**
* AdpTranslationModel
*/
class AdpTranslationModel 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_adp_translation';
/**
* 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 = ['id', 'adp_id', 'locale', 'title', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}