/** * 获取操作 */ 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 function query($isshow, $pid) { if (!$isshow && !$pid) { $datas = ActionModel::orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit); } elseif ($isshow && !$pid) { $datas = ActionModel::where('isshow', $isshow)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit); } elseif (!$isshow && $pid) { $datas = ActionModel::where('pid', $pid)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit); } elseif ($isshow && $pid) { $datas = ActionModel::where('isshow', $isshow)->where('pid', $pid)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit); } $datas->limit = $this->limit; return $datas; }