FurnitureGoodsModel.php 869 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace App\Models;
  3. use App\Models\BaseModel;
  4. /**
  5. * @description 产品管理
  6. * @author system;
  7. * @version 1.0
  8. * @date 2018-07-20 11:16:25
  9. *
  10. */
  11. class FurnitureGoodsModel extends BaseModel
  12. {
  13. /**
  14. * 数据表名
  15. *
  16. * @var string
  17. *
  18. */
  19. protected $table = 'furniture_goods';
  20. /**
  21. * 主键
  22. */
  23. protected $primaryKey = 'id';
  24. //分页
  25. protected $perPage = PAGE_NUMS;
  26. /**
  27. * 可以被集体附值的表的字段
  28. *
  29. * @var string
  30. */
  31. protected $fillable = [
  32. 'name',
  33. 'img',
  34. 'goods_id',
  35. 'sort',
  36. 'status',
  37. 'store_id'
  38. ];
  39. public function category(){
  40. return (new FurnitureGoodsCategoryModel())->find($this->category_id)?(new FurnitureGoodsCategoryModel())->find($this->category_id)->name:$this->category_id;
  41. }
  42. }