protected function generateEmailVerificationToken(IlluminateModel $user)
    {
        // Generate new token using Laravel's encryption key
        $token = hash_hmac('sha256', str_random(40), config('app.key'));

        // Expire timestamp
        $expire = Carbon::now()->addDays(config('nodes.api.email-verification.expire', 1));

        // If user has previously tried to reset his/her password
        // we should just update the token of the previous entry
        // instead of creating a new one
        $verificationToken = $this->where('email', '=', $user->email)->first();
        if (! empty($verificationToken)) {
            $verificationToken->update(['token' => $token, 'used' => 0, 'expire_at' => $expire->format('Y-m-d H:i:s')]);
        } else {
            $this->create(['email' => $user->email, 'token' => $token, 'expire_at' => $expire->format('Y-m-d H:i:s')]);
        }

        return $token;
    }
protected function generateEmailVerificationToken(IlluminateModel $user)
    {
        // Generate new token using Laravel's encryption key
        $token = hash_hmac('sha256', str_random(40), config('app.key'));

        // Expire timestamp
        $expire = Carbon::now()->addDays(config('nodes.api.email-verification.expire', 1));

        // If user has previously tried to reset his/her password
        // we should just update the token of the previous entry
        // instead of creating a new one
        $verificationToken = $this->where('email', '=', $user->email)->first();
        if (! empty($verificationToken)) {
            $verificationToken->update(['token' => $token, 'used' => 0, 'expire_at' => $expire->format('Y-m-d H:i:s')]);
        } else {
            $this->create(['email' => $user->email, 'token' => $token, 'expire_at' => $expire->format('Y-m-d H:i:s')]);
        }

        return $token;
    }
protected function generateEmailVerificationToken ( IlluminateModel $ user ) { // Generate new token using Laravel's encryption key $ token = hash_hmac ( 'sha256' , str_random ( 40 ) , config ( 'app.key' ) ) ; // Expire timestamp $ expire = Carbon :: now ( ) -> addDays ( config ( 'nodes.api.email-verification.expire' , 1 ) ) ; // If user has previously tried to reset his/her password // we should just update the token of the previous entry // instead of creating a new one $ verificationToken = $ this -> where ( 'email' , '=' , $ user -> email ) -> first ( ) ; if ( ! empty ( $ verificationToken ) ) { $ verificationToken -> update ( [ 'token' => $ token , 'used' => 0 , 'expire_at' => $ expire -> format ( 'Y-m-d H:i:s' ) ] ) ; } else { $ this -> create ( [ 'email' => $ user -> email , 'token' => $ token , 'expire_at' => $ expire -> format ( 'Y-m-d H:i:s' ) ] ) ; } return $ token ; }
Generate verification token.

@author Paulius Navickas <pana@nodes.dk>

@param  \Illuminate\Database\Eloquent\Model $user
@return string
Generate verification token .