Question

I have an old projects db for which i need to create a new web interface. Main problem with auth is that the login and password is in old db, but I can't write there, so basically i need to get auth data from one db and write the remember token to the other. Is it possible?

I already tried to play with eloquent, but stuck on the validation as my password is in base64...

Était-ce utile?

La solution

You can set preffered connection on your model - in this case User model.

1. Add this connection attribute to the models/User.php file

protected $connection = 'olddb';

2. Edit your config/database.php file and add connection as specified above

'connections' => array(

    //...

    'olddb' => array(
        'driver'    => 'mysql',
        'host'      => 'localhost',
        'database'  => 'database',
        'username'  => 'root',
        'password'  => '',
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
    ),

    //...

),

Since Laravel's Auth is tied to user model, Auth will use this connection instead of your default.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top