| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace App\Models;
- use Dcat\Admin\Traits\HasDateTimeFormatter;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use Illuminate\Database\Eloquent\Model;
- class Product extends Model
- {
- use HasDateTimeFormatter;
- use SoftDeletes;
- protected $table = 'product';
- protected $fillable = [
- 'type',
- 'user_id',
- 'name',
- 'content',
- 'image',
- 'status',
- 'url'
- ];
- protected $casts = [
- 'type'=>'array'
- ];
- public function type(){
- return $this->hasOne(ProductType::class,'id','type');
- }
- public function user(){
- return $this->hasOne(User::class,'id','user_id');
- }
- }
|