PHP code example of kaoken / laravel-confirmation-email

1. Go to this page and download the library: Download kaoken/laravel-confirmation-email 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/ */

    

kaoken / laravel-confirmation-email example snippets


[
    ...
    'defaults' => [
        'guard' => 'web',
        'passwords' => 'users',
        // add
        'confirmation' => 'users',
    ],
    ...
]

    protected function schedule(Schedule $schedule)
    {
        ...
        $schedule->call(function(){
            Confirmation::broker('user')->deleteUserAndToken();
        )->hourly();
    }


namespace App\Http\Controllers;
use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Kaoken\LaravelConfirmation\Controllers\AuthenticatesUsers;
use Kaoken\LaravelConfirmation\Controllers\ConfirmationUser;

class RegisterUserController extends Controller
{
    use AuthenticatesUsers, ConfirmationUser;

    /**
     * Use with AuthenticatesUsers trait.
     * @var string
     */
    protected $broker = 'users';

    /**
     * 1st registration View
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function getFirstRegister()
    {
        // Be prepared by yourself.
        return view('first_step_register');
    }
    
    /**
     * 1st registration
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse|mixed
     */
    public function postFirstRegister(Request $request)
    {
        $all = $request->only(['name', 'email', 'password']);
        $validator = Validator::make($all,[
            'name' => '

Route::group([
    'middleware' => ['guest:user'] ],
    function(){
        Route::get('login', 'AuthController@login');
    }
);
Route::get('register', 'AuthController@getFirstRegister');
Route::post('register', 'AuthController@postFirstRegister');
Route::get('register/{email}/{token}', 'AuthController@getCompleteRegistration');



namespace App;
use Kaoken\LaravelConfirmation\HasConfirmation;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable, HasConfirmation;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];
    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

}
 config\app.php
    'providers' => [
        ...
        // add
        Kaoken\LaravelConfirmation\ConfirmationServiceProvider::class
    ],

    'aliases' => [
        ...
        // add
        'Confirmation' => Kaoken\LaravelConfirmation\Facades\Confirmation::class
    ],
bash
php artisan vendor:publish --tag=confirmation
bash
php artisan migrate