CatSpecs.php 576 B

123456789101112131415161718192021
  1. <?php
  2. namespace app\admin\model;
  3. class CatSpecs extends Base
  4. {
  5. //设置字段信息
  6. protected $schema = [
  7. 'id' =>'bigint',//
  8. 'specs_id' =>'bigint',//规格id
  9. 'cat_id' =>'bigint',//分类规格id
  10. 'is_del' =>'tinyint',//
  11. 'addtime' =>'datetime',//
  12. ];
  13. protected $createTime='addtime';
  14. public function cat(){
  15. return $this->belongsTo(Cat::class,'cat_id','id');
  16. }
  17. public function specs(){
  18. return $this->belongsTo(Specs::class,'specs_id','id')->bind(["spec_name"]);
  19. }
  20. }