PHP code example of ahmedash95 / users-verification

1. Go to this page and download the library: Download ahmedash95/users-verification library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ahmedash95 / users-verification example snippets


$user = App\User::find(1);

// Generate token or get it if exists
$user->getToken();

// check if user is verified or not
$user->isVerified()

// check if token is valid for user
$token = 'random_token_generated_by_getToken()_method'
$user->verifyToken($token) // return true or false

// verify the user
if($user->verifyToken($token)) {
	$user->verify();
}

// remove user token
$user->flushToken();

// config/app.php
'providers' => [
    ...
    Ahmedash95\UsersVerification\UsersVerificationServiceProvider::class,

];

use Illuminate\Foundation\Auth\User as Authenticatable;

use Ahmedash95\UsersVerification\UsersVerification;

class User extends Authenticatable
{
    use UsersVerification;

public function getToken() : string

public function verifyToken(String $token) : bool

public function verify()

public static function findByToken($token)

public function flushToken()
bash
php artisan vendor:publish --provider="Ahmedash95\UsersVerification\UsersVerificationServiceProvider" --tag="migrations"
bash
php artisan migrate