with() публичный Метод

Add data to validation against
Автор: Steve Montambeault
public with ( array $input )
$input array
Пример #1
0
 /**
  * Update a current set of permissions
  *
  * @author Steve Montambeault
  * @link   http://stevemo.ca
  *
  * @param array $data
  *
  * @return \StdClass
  */
 public function update(array $data)
 {
     if ($this->validator->with($data)->validForUpdate()) {
         $data['permissions'] = explode(',', $data['permissions']);
         $this->permission->update($data);
         return true;
     } else {
         return false;
     }
 }
Пример #2
0
 /**
  * Reset a given user password
  *
  * @author Steve Montambeault
  * @link   http://stevemo.ca
  *
  * @param array $creds
  *
  * @return bool
  */
 public function reset(array $creds)
 {
     try {
         if ($this->validator->with($creds)->passes()) {
             $this->users->resetPassword($creds['code'], $creds['password']);
             return true;
         }
     } catch (UserNotFoundException $e) {
         $this->validator->add('UserNotFoundException', $e->getMessage());
     }
     return false;
 }
Пример #3
0
 /**
  * Update a group
  *
  * @author Steve Montambeault
  * @link   http://stevemo.ca
  *
  * @param array $data
  *
  * @return Bool
  */
 public function update(array $data)
 {
     try {
         if ($this->validator->with($data)->validForUpdate()) {
             $this->groups->update($data);
             return true;
         }
     } catch (GroupExistsException $e) {
         $this->validator->add('GroupExistsException', $e->getMessage());
     } catch (NameRequiredException $e) {
         $this->validator->add('NameRequiredException', $e->getMessage());
     }
     return false;
 }
Пример #4
0
 /**
  * Validate and update a existing user
  *
  * @author Steve Montambeault
  * @link   http://stevemo.ca
  *
  * @param array $data
  *
  * @return bool
  */
 public function update(array $data)
 {
     try {
         if ($this->validator->with($data)->validForUpdate()) {
             $this->users->update($data['id'], $this->validator->getData());
             return true;
         }
     } catch (LoginRequiredException $e) {
         $this->validator->add('LoginRequiredException', $e->getMessage());
     } catch (PasswordRequiredException $e) {
         $this->validator->add('PasswordRequiredException', $e->getMessage());
     } catch (UserExistsException $e) {
         $this->validator->add('UserExistsException', $e->getMessage());
     }
     return false;
 }