You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
620 B
31 lines
620 B
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Dcat\Admin\Traits\HasDateTimeFormatter;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class IndustryProduct extends BaseModel
|
|
{
|
|
use HasDateTimeFormatter;
|
|
use SoftDeletes;
|
|
|
|
protected $casts = ['pictures' => 'json', 'extends' => 'json'];
|
|
protected $appends = ['picture'];
|
|
protected $fillable = ['status'];
|
|
|
|
public function getPictureAttribute($value): string
|
|
{
|
|
return $this->pictures[0] ?? '';
|
|
}
|
|
|
|
public function supplier()
|
|
{
|
|
return $this->belongsTo(Supplier::class)->withTrashed();
|
|
}
|
|
|
|
public function category()
|
|
{
|
|
return $this->belongsTo(Category::class);
|
|
}
|
|
}
|