Get all database and tables and specific db data with laravel and mysql

Show all database       $dblist = DB::select("SHOW DATABASES"); 

foreach($dblist as $db){
echo $db->Database; // Getn name of datatabse
}

Select specific db and show all tables of it db


use Illuminate\Support\Facades\DB;
 DB::select("USE `mydb`");
$tables = DB::select('SHOW TABLES');

Select specific table
 $data = DB::select("select * from tablename");



Comments