12345678910111213141516171819202122232425 |
- <?php
- namespace App\Models;
- use Dcat\Admin\Traits\HasDateTimeFormatter;
- use Illuminate\Database\Eloquent\Model;
- class BaseProduct extends Model
- {
- use HasDateTimeFormatter;
- protected $table = 'base_product';
- protected $casts = [
- 'created_at' => 'datetime:Y-m-d H:i:s',
- 'updated_at' => 'datetime:Y-m-d H:i:s',
- 'parameters' => 'json', // 将 attributes 字段转换为数组
- ];
- public function baseProductCategory()
- {
- return $this->hasOne(BaseProductCategory::class,'id','category_id');
- }
- }
|