vendredi 21 décembre 2018

how to disconnect and reconnect the database globally in laravel 5.7

in controller.php (parent class)

    function __construct() {
           DB::disconnect('DataBase');
            }

 child class of parent class

i disconnect the database globally and reconnect the needed functions in child class

 public function getDomain()
        {
        DB::reconnect('DataBase');
        $select = "select * from product";
        $execute = DB::select($select);
        print_r($execute);
        return view('test');

        }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire