This commit is contained in:
2025-05-22 09:26:19 +08:00
parent f8fa2bf3a9
commit 80b6ea2076
42 changed files with 2571 additions and 1 deletions
@@ -0,0 +1,72 @@
<?php
namespace app\console\model;
use support\Model;
/**
* VehicleNewAlbumModel
*/
class VehicleNewAlbumModel 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_vehicle_new_album';
/**
* 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', 'vehicle_id', 'status', 'sort', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
/**
* 单条翻译
*/
public function translation()
{
return $this->hasOne(VehicleNewAlbumTranslationModel::class, 'album_id')->where('locale', locale());
}
/**
* 多条翻译
*/
public function translations()
{
return $this->hasMany(VehicleNewAlbumTranslationModel::class, 'album_id');
}
}
@@ -0,0 +1,56 @@
<?php
namespace app\console\model;
use support\Model;
/**
* VehicleNewAlbumTranslationModel
*/
class VehicleNewAlbumTranslationModel 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_vehicle_new_album_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', 'content_id', 'locale', 'alt', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
@@ -0,0 +1,80 @@
<?php
namespace app\console\model;
use support\Model;
/**
* VehicleNewAskedModel
*/
class VehicleNewAskedModel 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_vehicle_new_asked';
/**
* 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', 'vehicle_id', 'status', 'sort', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
/**
* 相册字段
*/
const VEHICLE_NEW_ASKED_FIELDS = [
'title',
'content',
];
/**
* 单条翻译
*/
public function translation()
{
return $this->hasOne(VehicleNewAskedTranslationModel::class, 'asked_id')->where('locale', locale());
}
/**
* 多条翻译
*/
public function translations()
{
return $this->hasMany(VehicleNewAskedTranslationModel::class, 'asked_id');
}
}
@@ -0,0 +1,56 @@
<?php
namespace app\console\model;
use support\Model;
/**
* VehicleNewAskedTranslationModel
*/
class VehicleNewAskedTranslationModel 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_vehicle_new_asked_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', 'asked_id', 'locale', 'title', 'content', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
@@ -0,0 +1,72 @@
<?php
namespace app\console\model;
use support\Model;
/**
* VehicleNewContentModel
*/
class VehicleNewContentModel 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_vehicle_new_content';
/**
* 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', 'vehicle_id', 'status', 'sort', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
/**
* 单条翻译
*/
public function translation()
{
return $this->hasOne(VehicleNewContentTranslationModel::class, 'content_id')->where('locale', locale());
}
/**
* 多条翻译
*/
public function translations()
{
return $this->hasMany(VehicleNewContentTranslationModel::class, 'content_id');
}
}
@@ -0,0 +1,56 @@
<?php
namespace app\console\model;
use support\Model;
/**
* VehicleNewContentTranslationModel
*/
class VehicleNewContentTranslationModel 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_vehicle_new_content_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', 'content_id', 'locale', 'content', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
+118
View File
@@ -0,0 +1,118 @@
<?php
namespace app\console\model;
use support\Model;
/**
* VehicleNewModel
*/
class VehicleNewModel 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_vehicle_new';
/**
* 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';
/**x`
* 允许自动填充模型字段
*/
protected $fillable = ['id', 'vin', 'brand', 'cover', 'album', 'price', 'type', 'energy', 'model', 'video', 'views', 'created_at', 'updated_at', 'location'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
/**
* 单条翻译
*/
public function translation()
{
return $this->hasOne(VehicleNewTranslationModel::class, 'vehicle_id')->where('locale', locale());
}
/**
* 多条翻译
*/
public function translations()
{
return $this->hasMany(VehicleNewTranslationModel::class, 'vehicle_id');
}
public function brand()
{
return $this->belongsTo(BrandModel::class, 'brand');
}
public function models()
{
return $this->belongsTo(ModelModel::class, 'model');
}
public function location()
{
return $this->belongsTo(LocationModel::class, 'location');
}
public function types()
{
return $this->belongsTo(TypesModel::class, 'type', 'id');
}
public function energy()
{
return $this->belongsTo(EnergyModel::class, 'energy', 'id');
}
public function album()
{
return $this->hasMany(VehicleNewAlbumModel::class, 'vehicle_id', 'id');
}
public function asked()
{
return $this->hasMany(VehicleNewAskedModel::class, 'vehicle_id', 'id');
}
public function trait()
{
return $this->hasMany(VehicleNewTraitModel::class, 'vehicle_id', 'id');
}
public function content()
{
return $this->hasMany(VehicleNewContentModel::class, 'vehicle_id', 'id');
}
}
@@ -0,0 +1,72 @@
<?php
namespace app\console\model;
use support\Model;
/**
* VehicleNewTraitModel
*/
class VehicleNewTraitModel 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_vehicle_new_trait';
/**
* 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', 'vehicle_id', 'status', 'sort', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
/**
* 单条翻译
*/
public function translation()
{
return $this->hasOne(VehicleNewTraitTranslationModel::class, 'trait_id')->where('locale', locale());
}
/**
* 多条翻译
*/
public function translations()
{
return $this->hasMany(VehicleNewTraitTranslationModel::class, 'trait_id');
}
}
@@ -0,0 +1,56 @@
<?php
namespace app\console\model;
use support\Model;
/**
* VehicleNewTraitTranslationModel
*/
class VehicleNewTraitTranslationModel 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_vehicle_new_trait_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', 'trait_id', 'locale', 'title', 'content', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}
@@ -0,0 +1,56 @@
<?php
namespace app\console\model;
use support\Model;
/**
* VehicleNewTranslationModel
*/
class VehicleNewTranslationModel 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_vehicle_new_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', 'vehicle_id', 'locale', 'condition_desc', 'location', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
}