Cartalyst\Sentinel\Activations\IlluminateActivationRepository::complete PHP Метод

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

{@inheritDoc}
public complete ( Cartalyst\Sentinel\Users\UserInterface $user, $code )
$user Cartalyst\Sentinel\Users\UserInterface
    public function complete(UserInterface $user, $code)
    {
        $expires = $this->expires();
        $activation = $this->createModel()->newQuery()->where('user_id', $user->getUserId())->where('code', $code)->where('completed', false)->where('created_at', '>', $expires)->first();
        if ($activation === null) {
            return false;
        }
        $activation->fill(['completed' => true, 'completed_at' => Carbon::now()]);
        $activation->save();
        return true;
    }

Usage Example

Пример #1
0
 /**
  * {@inheritDoc}
  *
  * @static 
  */
 public static function complete($user, $code)
 {
     return \Cartalyst\Sentinel\Activations\IlluminateActivationRepository::complete($user, $code);
 }