public function getRight($id) { $titleAction = "Access Rights " . $this->titleAction; if ($id != 1) { $model = $this->model->find($id); $titleAction = "Access Rights :" . $model->name; $menus = Menu::whereParentId(0)->orderBy('order', 'asc')->get(); $active = function ($paramId) use($id) { $cek = Right::whereRoleId($id)->whereMenuId($paramId)->first(); if (!empty($cek->id)) { return 'checked'; } }; return view('admin.role.right', compact('titleAction', 'model', 'menus', 'active')); } else { echo '<h2>Cannot Update Super Admin!</h2>'; } }