海南旅游SAAS
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

4 years ago
  1. <?php
  2. namespace App\Models;
  3. use Dcat\Admin\Traits\HasDateTimeFormatter;
  4. use Illuminate\Database\Eloquent\SoftDeletes;
  5. class IndustryProduct extends BaseModel
  6. {
  7. use HasDateTimeFormatter;
  8. use SoftDeletes;
  9. protected $casts = ['pictures' => 'json', 'extends' => 'json'];
  10. protected $appends = ['picture'];
  11. protected $fillable = ['status'];
  12. public function getPictureAttribute($value): string
  13. {
  14. return $this->pictures[0] ?? '';
  15. }
  16. public function supplier()
  17. {
  18. return $this->belongsTo(Supplier::class)->withTrashed();
  19. }
  20. public function category()
  21. {
  22. return $this->belongsTo(Category::class);
  23. }
  24. }