| xqd
@@ -49,7 +49,12 @@ class AdminUserController extends BaseController
|
|
|
$items = $items->where($tmp_item, 'like', '%' . $request->input($tmp_item) . '%');
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ if ($request->input('admin_role_id'))
|
|
|
+ {
|
|
|
+ $items->whereHas('adminroles',function ($query){
|
|
|
+ $query->where('id','=',request('admin_role_id'));
|
|
|
+ });
|
|
|
+ }
|
|
|
$select_items = collect([]);
|
|
|
foreach($select_items as $select_item) {
|
|
|
if($request->has($select_item) && !empty($request->input($select_item))) {
|
| xqd
@@ -58,15 +63,16 @@ class AdminUserController extends BaseController
|
|
|
}
|
|
|
|
|
|
$items = $items->paginate();
|
|
|
-// foreach($items as $item) {
|
|
|
-// $item->role_name = empty($item->adminRole) ? '' : $item->adminRole->name;
|
|
|
-// }
|
|
|
+ foreach($items as $item) {
|
|
|
+ $item->role_name = empty($item->adminroles) ? '' : $item->adminroles->name;
|
|
|
+ }
|
|
|
return response()->json(['code' => 0, 'message' => '', 'count' => $items->total(), 'data' => $items->items()]);
|
|
|
}
|
|
|
|
|
|
public function create()
|
|
|
{
|
|
|
$admin_role_options = $this->adminRole->getOptions();
|
|
|
+ unset($admin_role_options[0]);
|
|
|
list($model, $model_name, $pre_uri) = array($this->model, $this->model_name, $this->pre_uri);
|
|
|
return view($this->view_path . 'create', compact('model', 'model_name','pre_uri', 'admin_role_options'));
|
|
|
}
|
| xqd
@@ -90,6 +96,7 @@ class AdminUserController extends BaseController
|
|
|
{
|
|
|
if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) return back()->withErrors(['sg_error_info' => '找不到要编辑的数据']);
|
|
|
$admin_role_options = $this->adminRole->getOptions();
|
|
|
+ unset($admin_role_options[0]);
|
|
|
list($model, $model_name, $pre_uri) = array($this->model, $this->model_name, $this->pre_uri);
|
|
|
return view($this->view_path . 'edit', compact('model', 'model_name', 'pre_uri', 'item', 'admin_role_options'));
|
|
|
}
|