/** * 获取操作 */ public function getActions($role = null) { if ($role) { $datas = ActionModel::where('role_id', $role)->orderBy('pid', 'asc')->get(); } else { $datas = ActionModel::orderBy('pid', 'asc')->get(); } return $datas; }
/** * 系统后台左侧菜单栏用 */ public static function getAdminMenus() { $actionArr = array(); $roleActions = RoleActionModel::where('role_id', \Session::get('admin.role_id'))->get(); foreach ($roleActions as $roleAction) { $actionArr[] = $roleAction->action_id; } return ActionModel::whereIn('id', $actionArr)->where('isshow', 2)->orderBy('sort', 'desc')->get(); }
public static function getActions() { return Tools::getChild(ActionModel::getAdminMenus(), $pid = 0); }
/** * 排序 +1 increase */ public function reduce($id) { $action = ActionModel::find($id); if ($action->sort > 0) { ActionModel::where('id', $id)->increment('sort', -1); } return redirect(DOMAIN . 'admin/action'); }