DepartmentStaff.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Name: 芸众商城系统
  5. * Author: 广州市芸众信息科技有限公司
  6. * Profile: 广州市芸众信息科技有限公司位于国际商贸中心的广州,专注于移动电子商务生态系统打造,拥有芸众社交电商系统、区块链数字资产管理系统、供应链管理系统、电子合同等产品/服务。官网 :www.yunzmall.com www.yunzshop.com
  7. * Date: 2021/9/22
  8. * Time: 13:37
  9. */
  10. namespace business\common\models;
  11. use app\common\models\BaseModel;
  12. use business\common\services\SettingService;
  13. use Illuminate\Database\Eloquent\Builder;
  14. use Illuminate\Database\Eloquent\SoftDeletes;
  15. class DepartmentStaff extends BaseModel
  16. {
  17. public $table = 'yz_business_department_staff';
  18. public $timestamps = true;
  19. protected $guarded = [];
  20. protected $appends = [];
  21. protected $casts = [];
  22. public function business($business_id = 0)
  23. {
  24. $business_id = $business_id ?: SettingService::getBusinessId();
  25. return self::uniacid()->where('business_id', $business_id);
  26. }
  27. public function hasOneDepartment()
  28. {
  29. return $this->hasOne(Department::class, 'id', 'department_id');
  30. }
  31. public function hasOneStaff()
  32. {
  33. return $this->hasOne(Staff::class, 'id', 'staff_id');
  34. }
  35. }