two databse in laravel code example
Example 1: laravel 8 app with more than one database
$blogs = DB::connection('mysql2')->table("blog")->get();print_r($blogs);
Example 2: 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; }}