| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- /**
- *
- * @copyright ©2020 点小铺
- * @author hanj
- * @link: https://dyuit.com
- * Created by VSCode
- */
- namespace app\common\model\store\shop;
- use app\common\model\BaseModel;
- /**
- * 商家门店店员模型
- * Class Clerk
- * @package app\common\model\store
- */
- class Clerk extends BaseModel
- {
- protected $name = 'store_shop_clerk';
- /**
- * 关联用户表
- * @return \think\model\relation\BelongsTo
- */
- public function user()
- {
- $module = static::getCalledModule() ?: 'common';
- return $this->BelongsTo("app\\{$module}\\model\\User");
- }
- /**
- * 关联门店表
- * @return \think\model\relation\BelongsTo
- */
- public function shop()
- {
- $module = static::getCalledModule() ?: 'common';
- return $this->BelongsTo("app\\{$module}\\model\\store\\Shop");
- }
- /**
- * 店员详情
- * @param $where
- * @return static|null
- * @throws \think\exception\DbException
- */
- public static function detail($where)
- {
- $filter = is_array($where) ? $where : ['clerk_id' => $where];
- return static::get(array_merge(['is_delete' => 0], $filter));
- }
- }
|