public function singelModules($cid = null) { if (!$cid) { $cid = 0; } return ComModuleModel::where('genre', '>', 20)->whereIn('cid', [0, $cid])->get(); }
/** * 获取所属模块id */ public function getModuleId($cid, $genre) { $moduleModel = ComModuleModel::where('cid', $cid)->where('genre', $genre)->first(); if (!$moduleModel) { $moduleModel = ComModuleModel::where('cid', 0)->where('genre', $genre)->first(); } return $moduleModel->id; }
public function create() { //判断有无该公司的扩展单页 if (!count(ComModuleModel::where('cid', $this->cid)->get())) { echo "<script>alert('没有单页模,先去添加模块!');history.go(-1);</script>"; exit; } $curr['name'] = $this->lists['create']['name']; $curr['url'] = $this->lists['create']['url']; $result = ['modules' => $this->model->singelModules($this->cid), 'model' => $this->model, 'lists' => $this->lists, 'curr' => $curr, 'curr_func' => $this->lists['func']['url']]; return view('company.admin.single.create', $result); }
public function query() { $datas = ComModuleModel::where('genre', $this->genre)->where('cid', $this->cid)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit); $datas->limit = $this->limit; return $datas; }
public function forceDelete($id) { ComModuleModel::where('id', $id)->delete(); return redirect(DOMAIN . 'admin/commodule'); }
/** * 控制模块排序 */ public function sort($id, $sort) { ComModuleModel::where('id', $id)->update(['sort' => $sort]); return redirect(DOMAIN . 'company/admin/layout'); }