PHP code example of quantical-solutions / session-out-modal-laravel

1. Go to this page and download the library: Download quantical-solutions/session-out-modal-laravel 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/ */

    

quantical-solutions / session-out-modal-laravel example snippets



// Add the ServiceProvider to the providers array in
// config/app.php

'providers' => [
    '...',
    'Quantic\SessionOut\SessionExpiredServiceProvider::class',
];

@

return [
    
    // whether using broadcasting feature to make the modal disappear faster
    'avail_broadcasting' => false,
];

@



// App\Providers\EventServiceProvider

protected $listen = [
        'Illuminate\Auth\Events\Login' => [
            'App\Listeners\SuccessfulLogin',
        ],
    ];

// App\Listeners\SuccessfulLogin

use Quantic\SessionOut\Classes\AuthState;

/**
* Handle the event.
*
* @param  Login  $event
* @return void
*/
public function handle(Login $user)
{
	AuthState::sessionAvailable();
}

namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;

class VerifyCsrfToken extends Middleware
{
    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
        '/check-auth',
        '/session',
        '/rebirth-session'
    ];
}
bash
php artisan vendor:publish --provider="Quantic\SessionOut\SessionExpiredServiceProvider"
bash
php artisan queue:work --queue=default,usersession
bash
php artisan vendor:publish --provider="Quantic\SessionOut\SessionExpiredServiceProvider" --force

php artisan vendor:publish --provider="Quantic\SessionOut\SessionExpiredServiceProvider" --tag=public --force
bash
php artisan config:clear
php artisan queue:restart // only when using broadcasting