PHP code example of coderjp / verifier

1. Go to this page and download the library: Download coderjp/verifier 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/ */

    

coderjp / verifier example snippets




use Coderjp\Verifier\Traits\VerifierUserTrait;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
    use Authenticatable, CanResetPassword, EntrustUserTrait, SoftDeletes, VerifierUserTrait;

    ...
}


Hi {{ $user['name'] }},

Welcome to our site. Please click the following link to activate your account:

{{ url('verify', $user['verification_code']) }}

Regards, CoderJP


...

public function store(CreateUserRequest $request)
{
        $user = User::create($request->all());
        $user->sendVerification();
        
        ...
}

...




class UserController extends Controller {

    ...
    
    public function validate(Request $request, $code)
    {
            $user = User::verify($code);
            
            if ($user) {
                // $user = User model
                return view('user.validated');
            } else {
                // $user = null;
                return view('user.invalid');
            }
    }

    ...
    
}

...

public function getVerificationEmailName() {
    return ucwords($this->first_name .' '. $this->last_name);
}

...

...

public function getVerificationEmailSubject()
{
    return 'Welcome to our site ' . $this->name;
}

...