PHP code example of gurinder / laravel-auth

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

    

gurinder / laravel-auth example snippets


Schema::create('users', function (Blueprint $table) {
    ...
    $table->boolean('email_verified')->default(false);
    $table->string('email_verification_token')->nullable();
    ...
});

return [
    
    // ....
    
    'twitter' => [
        'client_id'     => env('TWITTER_CLIENT_ID'),
        'client_secret' => env('TWITTER_CLIENT_SECRET'),
        'redirect'      => env('SOCIALITE_TWITTER_CALLBACK'),
        'access_token'  => env('TWITTER_ACCESS_TOKEN'),
        'access_secret' => env('TWITTER_ACCESS_SECRET'),
    ],

    'github' => [
        'client_id'     => env('GITHUB_CLIENT_ID'),
        'client_secret' => env('GITHUB_CLIENT_SECRET'),
        'redirect'      => env('SOCIALITE_GITHUB_CALLBACK'),
    ],

    'facebook' => [
        'client_id'     => env('FACEBOOK_APP_ID'),
        'app_id'        => env('FACEBOOK_APP_ID'),
        'client_secret' => env('FACEBOOK_APP_SECRET'),
        'redirect'      => env('SOCIALITE_FACEBOOK_CALLBACK'),
    ],

    'google' => [
        'recaptcha_site_key'   => env('GOOGLE_RECAPTCHA_SITE_KEY'),
        'recaptcha_secret_key' => env('GOOGLE_RECAPTCHA_SECRET_KEY'),
        'client_id'            => env('GOOGLE_CLIENT_ID'),
        'client_secret'        => env('GOOGLE_CLIENT_SECRET'),
        'developer_key'        => env('GOOGLE_DEVELOPER_KEY'),
        'redirect'             => env('SOCIALITE_GOOGLE_CALLBACK')
    ]

];

return [
    // Open or Close Registration
    'registration_open'              => true,

    // Name fields to Register, make sure it matches with your user model
    'registration_name_fields'       => [
        // 'name'
        'first_name',
        'last_name',
    ],

    // validation rules for registeration
    // Note: Do not delete data field, its r user is successfulle logged in
    'redirect_path_after_login' => '/login-successful',

    // Redirect path after user is successfulle reseted password
    'redirect_path_after_password_reset' => '/password-reset-done',

    // Redirect path after user registered and email confiremed via mail
    'redirect_path_after_email_confirmation' => '/email-is-confirmed',

    // User model must have a method $user->assignRole($roles)
    // in order to this works
    // And it must accept role slug, role id, roles array, role instance
    // NOTE -> make sure this role exist in database
    'default_roles'                          => ['subscriber'],

    // Email configuration to send welcome and confirmation(email) emails to user
    'email_from' => [
        'name'  => 'Gurinder Laravel Auth',
        'email' => '[email protected]'
    ]

];
 bash
// Optional
php artisan vendor:publish --tag="gauth::views"

// Optional
php artisan vendor:publish --tag="gauth::config"