Beispiel #1
0
 /**
  * 增加功能的时候的表单验证
  *
  * @access public
  */
 public function add(AclSave $data)
 {
     $rules = array('name' => 'required', 'module' => 'required', 'class' => 'required', 'action' => 'required', 'pid' => 'required|numeric');
     $messages = array('name.required' => Lang::get('acl.acl_name_empty'), 'module.required' => Lang::get('acl.acl_module_empty'), 'class.required' => Lang::get('acl.acl_class_empty'), 'pid.numeric' => Lang::get('acl.acl_pid_empty'), 'pid.required' => Lang::get('acl.acl_pid_empty'), 'action.required' => Lang::get('acl.acl_action_empty'));
     $validator = Validator::make($data->toArray(), $rules, $messages);
     if ($validator->fails()) {
         $this->errorMsg = $validator->messages()->first();
         return false;
     }
     return true;
 }
Beispiel #2
0
 /**
  * 编辑功能权限入库
  *
  * @access private
  */
 private function updatePermission()
 {
     $params = new AclSave();
     $manager = new AclProcess();
     $httpReferer = Session::getOldInput('http_referer');
     $params->setAttributes((array) Request::input('data'));
     if ($manager->editAcl($params) !== false) {
         $backUrl = !empty($httpReferer) ? $httpReferer : route('foundation.acl.index');
         return Js::locate($backUrl, 'parent');
     }
     return Js::error($manager->getErrorMessage());
 }