PHP code example of elysiumrealms / database-router

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

    

elysiumrealms / database-router example snippets


$model = Model::router()->first();

$model = Admin::where('id', 1)->router()->first();

$model = Admin::router()->where('id', 1)->first();

DB::table('users')->router()->find(1);

$model = Model::router()
    ->update(['name' => 'new-name']);

$model = Admin::where('id', 1)->router()
    ->update(['name' => 'new-name']);

$model = Admin::router()->where('id', 1)
    ->update(['name' => 'new-name']);

DB::table('users')->router()
    ->update(['name' => 'new-name']);
bash
    php artisan db:router:install