BusinessApply.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 \app\backend\modules\member\models\Member;
  13. use Illuminate\Database\Eloquent\Builder;
  14. use Illuminate\Database\Eloquent\SoftDeletes;
  15. class BusinessApply extends BaseModel
  16. {
  17. public $table = 'yz_work_wechat_platform_crop_apply';
  18. public $timestamps = true;
  19. protected $guarded = [];
  20. protected $appends = [];
  21. protected $casts = [];
  22. const STATUS_WAIT = 0;//等待审核
  23. const STATUS_SUCCESS = -1;//审核通过
  24. const STATUS_FAIL = -1;//审核失败
  25. public function scopeSearch(Builder $query, $search)
  26. {
  27. $query->status($search['status']);
  28. $query->name($search['name']);
  29. $query->orderBy('id', 'DESC');
  30. }
  31. public function scopeName(Builder $query, $name)
  32. {
  33. if ($name || !is_null($name) || $name !== '') {
  34. $query->where('name', 'like', "%{$name}%");
  35. }
  36. }
  37. public function scopeStatus(Builder $query, $status)
  38. {
  39. if ($status || $status === 0 || $status === '0') {
  40. $query->where('status', $status);
  41. }
  42. }
  43. public function hasOneMember()
  44. {
  45. return $this->hasOne(Member::class, 'uid', 'uid');
  46. }
  47. }