I got several .sql files of countries, states and cities of the world from github. How can I run them with Laravel\'s seed files to populate those tables in my database?
As used by other answers, DB::unprepared
does not work with more complex SQL files.
Another better solution would be to use the MySQL cli directly inside a process:
$process = new Process([
'mysql',
'-h',
DB::getConfig('host'),
'-u',
DB::getConfig('user'),
'-p' . DB::getConfig('password'),
DB::getConfig('database'),
'-e',
"source path/to/schema.sql"
]);
$process->mustRun();