PHP code example of techsemicolon / laravel-dynamic-user-connection

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

    

techsemicolon / laravel-dynamic-user-connection example snippets



namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{

    public $dynamic_connection_database = 'database_name';
    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [

        'password', 'remember_token',
    ];


namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    public $dynamic_connection_database = 'database_name';

    // Optional
    public $dynamic_connection_username = 'database_username';
    public $dynamic_connection_password = 'database_password';

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [

        'password', 'remember_token',
    ];