PHP code example of stauth / laravel-stauth

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

    

stauth / laravel-stauth example snippets


namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Stauth\StauthServiceProvider;

class StauthProtectionServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        if ($this->app->environment('local', 'staging')) {
            $this->app->register(StauthServiceProvider::class);
        }
    }
}


'providers' => [

        /**
         * Stauth app access protection
         */
        App\Providers\StauthProtectionServiceProvider::class,     
],


'providers' => [

        /**
         * Staging access control
         */
        Stauth\StauthServiceProvider::class,        
],


    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
   
        'web' => [
            ...
            \Stauth\Middleware\StauthProtection::class,
    ],
bash

php artisan vendor:publish --provider="Stauth\StauthServiceProvider" --tag=config