laravel use second database code example
Example 1: laravel 8 app with more than one database
<?php class BlogController extends BaseController{ public function getRecord() { $blogModel = new Blog; $find = $blogModel->find(1); return $find; }}
Example 2: laravel 8 app with more than one database
<?php class BlogController extends BaseController{ public function getRecord() { $blogModel = new Blog; $blogModel->setConnection('mysql2'); $find = $blogModel->find(1); return $find; }}