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

Add a message to the bag.
Автор: Steve Montambeault
public add ( string $key, string $message )
$key string
$message string
Пример #1
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;
 }
Пример #2
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;
 }
Пример #3
0
 /**
  * Validate and log in a user
  *
  * @author Steve Montambeault
  * @link   http://stevemo.ca
  *
  * @param array $credentials
  * @param bool  $remember
  *
  * @return bool
  */
 public function login(array $credentials, $remember)
 {
     try {
         $this->users->authenticate($credentials, $remember);
         return true;
     } catch (LoginRequiredException $e) {
         $this->validator->add('LoginRequiredException', $e->getMessage());
     } catch (PasswordRequiredException $e) {
         $this->validator->add('PasswordRequiredException', $e->getMessage());
     } catch (WrongPasswordException $e) {
         $this->validator->add('WrongPasswordException', $e->getMessage());
     } catch (UserNotActivatedException $e) {
         $this->validator->add('UserNotActivatedException', $e->getMessage());
     } catch (UserNotFoundException $e) {
         $this->validator->add('UserNotFoundException', $e->getMessage());
     } catch (UserSuspendedException $e) {
         $this->validator->add('UserSuspendedException', $e->getMessage());
     } catch (UserBannedException $e) {
         $this->validator->add('UserBannedException', $e->getMessage());
     }
     return false;
 }