123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace app\model\supplier;
- use app\model\system\admin\SystemAdmin;
- use crmeb\basic\BaseModel;
- use crmeb\traits\ModelTrait;
- use think\Model;
- class SystemSupplier extends BaseModel
- {
- use ModelTrait;
-
- protected $pk = 'id';
-
- protected $name = 'system_supplier';
-
- public function admin()
- {
- return $this->hasOne(SystemAdmin::class, 'id', 'admin_id')->field(['id', 'account', 'pwd', 'admin_type', 'is_del', 'level', 'roles'])->bind([
- 'account',
- 'pwd',
- 'admin_type',
- 'level',
- 'roles',
- 'admin_is_del' => 'is_del',
- ]);
- }
-
- public function searchKeywordsAttr($query, $value)
- {
- if ($value != '') {
- $query->where('supplier_name', 'LIKE', "%$value%");
- }
- }
-
- public function searchIsDelAttr($query, $value)
- {
- $query->where('is_del', $value ?? 0);
- }
- }
|