| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace App\Module\Pet\Models;
- use UCore\ModelCore;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- /**
- * 宠物洗髓记录模型
- *
- * field start
- * @property int $id
- * @property int $pet_id
- * @property int $old_grade
- * @property int $new_grade
- * @property \Carbon\Carbon $remould_time
- * @property \Carbon\Carbon $created_at
- * field end
- */
- class PetRemouldLog extends ModelCore
- {
- /**
- * 与模型关联的表名
- *
- * @var string
- */
- protected $table = 'pet_remould_logs';
- /**
- * 指示模型是否应该被打上时间戳
- * 由于这是日志表,只需要创建时间,不需要更新时间
- *
- * @var bool
- */
- public $timestamps = true;
- /**
- * 更新时间戳字段名
- * 设置为null表示不使用updated_at字段
- *
- * @var string|null
- */
- const UPDATED_AT = null;
- // attrlist start
- protected $fillable = [
- 'id',
- 'pet_id',
- 'old_grade',
- 'new_grade',
- 'remould_time',
- ];
- // attrlist end
- /**
- * 应该被转换为原生类型的属性
- *
- * @var array
- */
- protected $casts = [
- 'pet_id' => 'integer',
- 'old_grade' => 'integer',
- 'new_grade' => 'integer',
- 'remould_time' => 'datetime',
- 'created_at' => 'datetime',
- ];
- /**
- * 获取关联的宠物
- *
- * @return BelongsTo
- */
- public function pet(): BelongsTo
- {
- return $this->belongsTo(PetUser::class, 'pet_id');
- }
- }
|