Пример #1
0
 /**
  * 增加用户组的时候的表单验证
  *
  * @access public
  */
 public function add(\App\Services\Admin\Group\Param\GroupSave $data)
 {
     $rules = array('group_name' => 'required', 'level' => 'required|numeric');
     $messages = array('group_name.required' => Lang::get('group.group_name_empty'), 'level.required' => Lang::get('group.group_level_empty'), 'level.numeric' => Lang::get('group.group_level_empty'));
     $validator = Validator::make($data->toArray(), $rules, $messages);
     if ($validator->fails()) {
         $this->errorMsg = $validator->messages()->first();
         return false;
     }
     return true;
 }
Пример #2
0
 /**
  * 编辑用户组
  *
  * @access private
  */
 private function updateGroup()
 {
     $params = new GroupSave();
     $manager = new GroupProcess();
     $httpReferer = Session::getOldInput('http_referer');
     $params->setAttributes((array) Request::input('data'));
     if (!$manager->editGroup($params)) {
         return Js::error($manager->getErrorMessage());
     }
     $this->setActionLog();
     return Js::locate(!empty($httpReferer) ? $httpReferer : route('foundation.group.index'), 'parent');
 }