PHP code example of touhedul / users

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

    

touhedul / users example snippets


    'facebook' => [
        'client_id' => env('FACEBOOK_CLIENT_ID', '147107342556627'),
        'client_secret' => env('FACEBOOK_CLIENT_SECRET', 'eda29465e6a4a98b5f89a1c2a3829f14'),
        'redirect' => env('FACEBOOK_CALLBACK','http://properos.com/auth/facebook/callback')
    ],
    
    'google' => [
        'client_id' => env('GOOGLE_CLIENT_ID', '200207622942-nadc5euejp1fb7jj1m13fdhu30ot4icc.apps.googleusercontent.com'),
        'client_secret' => env('GOGOLE_CLIENT_SECRET', 'uhIvqdMkWVD43Lw9EvvsMfQf'),
        'redirect' => env('GOOGLE_CALLBACK','http://properos.com/auth/google/callback')
        
    ]

    Laravel\Socialite\SocialiteServiceProvider::class,

    'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'unix_socket' => env('DB_SOCKET', ''),
        'charset' => 'utf8',
        'collation' => 'utf8_general_ci',
        'prefix' => '',
        'strict' => true,
        'engine' => 'Innodb',
    ],

    'role' => \Properos\Users\Middleware\RoleMiddleware::class,

    'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
    'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class

    'providers' => [
        '...',
        Properos\Users\UsersServiceProvider::class,
        '...'
    ]

    'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => \Properos\Users\Models\User::class,
        ],
    ],

    Set all roles on RolesPermissionsTableSeeder and users on UsersTableSeeder
    $this->call(RolesPermissionsTableSeeder::class);
    $this->call(UsersTableSeeder::class);

        Descomment 
        use Laravel\Passport\HasApiTokens;
        use HasApiTokens;
        in \Models\Users.php
    

    Route::get('/admin/dashboard', function(){
        return view('be.index');
    })->middleware(['auth', 'role:admin']);