ConfigPickupNode.php 796 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\Models;
  3. class ConfigPickupNode extends BaseModel
  4. {
  5. protected $table = 'config_pickup_node';
  6. /**
  7. * 可被批量赋值的字段
  8. * @var array
  9. */
  10. protected $fillable = ['pickup_group_id','store_ids','city_name','city_id','name','address','longitude','latitude','pickup_code','work_time','manager_name','manager_mobile','store_ids','receive_type'];
  11. //一对多关联储存方式表
  12. public function configStoreType()
  13. {
  14. return $this->hasMany('App\Models\ConfigStoreType','store_ids');
  15. }
  16. //获取储存方式名称
  17. public function getStoreNameAttribute()
  18. {
  19. $storeId = ConfigStoreType::find($this->store_ids);
  20. if($storeId){
  21. return $storeId->name;
  22. }
  23. return '';
  24. }
  25. }