PHP code example of properos / laravel-users

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

    

properos / laravel-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\Middlewares\RoleMiddleware::class,
    'permission' => \Properos\Users\Middlewares\PermissionMiddleware::class,
    'role_or_permission' => \Properos\Users\Middlewares\RoleOrPermissionMiddleware::class,

    ...
    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'sanctum',
            'provider' => 'users'
        ],
    ],
    ...

    ...
    '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);

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