Cartalyst\Sentinel\Reminders\IlluminateReminderRepository::complete PHP Method

complete() public method

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

Usage Example

 /**
  * {@inheritDoc}
  *
  * @static 
  */
 public static function complete($user, $code, $password)
 {
     return \Cartalyst\Sentinel\Reminders\IlluminateReminderRepository::complete($user, $code, $password);
 }