PHP code example of kango / auth

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

    

kango / auth example snippets




namespace App\Models;

use Kango\Auth\Models\User as BaseUser;

class User extends BaseUser
{
    //
}

use App\Models\User;

'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => User::class,
    ],
],

use Kango\Auth\Http\Middleware\EnsureVerified;

->withMiddleware(function (Middleware $middleware): void {
    $middleware->alias([
        'verified' => EnsureVerified::class,
    ]);

    $middleware->redirectGuestsTo(fn () => route('kango.auth.login'));
})

Route::middleware(['auth', 'verified'])->group(function () {
    // ...
});

use Kango\Auth\Models\User as BaseUser;
use Spatie\Permission\Traits\HasRoles;

class User extends BaseUser
{
    use HasRoles;
}
bash
composer vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
php artisan migrate
bash
php artisan vendor:publish --tag=kango-auth-config
bash
php artisan migrate
bash
php artisan config:clear