Browse Source

选择地接只出现role_id=2的

develop
李可松 4 years ago
parent
commit
839a243515
  1. 7
      app/AdminAgent/Renderable/SelectGuide.php

7
app/AdminAgent/Renderable/SelectGuide.php

@ -1,7 +1,6 @@
<?php
namespace App\AdminAgent\Renderable;
use App\AdminAgent\Repositories\User;
use App\Common\UserStatus;
use App\Models\Guide;
use Dcat\Admin\Admin;
@ -25,7 +24,11 @@ class SelectGuide extends LazyRenderable
$grid->disableBatchDelete();
$grid->disableBatchActions();
$grid->model()->where(['status' => UserStatus::NORMAL]);
$grid->model()->where(['status' => UserStatus::NORMAL])
->whereExists(function ($query) {
$role_table = 'admin_guide_role_users';
return $query->from($role_table)->whereRaw("guides.id=$role_table.user_id")->where('role_id', 2);
});
$grid->quickSearch(['contact_phone', 'name'])->placeholder('搜索手机号、地接名称');
$grid->column('id');

Loading…
Cancel
Save