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

exists() public method

{@inheritDoc}
public exists ( Cartalyst\Sentinel\Users\UserInterface $user, $code = null )
$user Cartalyst\Sentinel\Users\UserInterface
    public function exists(UserInterface $user, $code = null)
    {
        $expires = $this->expires();
        $reminder = $this->createModel()->newQuery()->where('user_id', $user->getUserId())->where('completed', false)->where('created_at', '>', $expires);
        if ($code) {
            $reminder->where('code', $code);
        }
        return $reminder->first() ?: false;
    }

Usage Example

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