Example #1
0
 public static function boot()
 {
     parent::boot();
     User::created(function ($user) {
         if ($user->type == User::TYPE_PAYEE) {
             AuthorizationToken::createAuthorizationToken($user);
         }
     });
 }
Example #2
0
 public function add(User $user)
 {
     $query = $this->_db->prepare('INSERT INTO t_user (login, password, created, profil, status)
                             VALUES (:login, :password, :created, :profil, :status)') or die(print_r($this->_db->errorInfo()));
     $query->bindValue(':login', $user->login());
     $query->bindValue(':password', $user->password());
     $query->bindValue(':created', $user->created());
     $query->bindValue(':profil', $user->profil());
     $query->bindValue(':status', $user->status());
     $query->execute();
     $query->closeCursor();
 }