예제 #1
0
 /**
  * Get a validator for an incoming registration request.
  *
  * @param  array  $data
  * @return \Illuminate\Contracts\Validation\Validator
  */
 protected function validator(array $data)
 {
     Validator::extend('unique_file', function ($attribute, $value, $parameters, $validator) use($data) {
         return User::find(md5($data['email'])) ? false : true;
     });
     return Validator::make($data, ['name' => 'required|max:255', 'email' => 'required|email|max:255|unique_file:user', 'password' => 'required|min:6|confirmed']);
 }
예제 #2
0
 public function postEdit($id)
 {
     $iuser = Input::get('user');
     $user = User::find($id);
     if (@$iuser['user_groups']) {
         $new_set = [];
         foreach ($iuser['user_groups'] as $key => $value) {
             $new_set[$key] = ref(UserGroup::find($key));
         }
         if ($user->type === 0) {
             $new_set[1] = ref(UserGroup::find(1));
         }
         $iuser['user_groups'] = $new_set;
     }
     foreach ($iuser as $key => $value) {
         $user->{$key} = $value;
     }
     $user->export();
     return \Redirect::back()->with('message_type', 'success')->with('message', 'Success!');
 }