1) Clear sql file from unnecessary lines and leave only
insert
query For example:
INSERT INTO `topwords` (`id`, `word`, `frequency`, `deleted`) VALUES
(1, 'the', 22038615, 0),
(2, 'be', 12545825, 0)
...
2) Add SQL file in a public folder or App/someFolderForSQLFiles 3) Use this in seeder
  $path = base_path('public\topwords.sql');
        $sql = file_get_contents($path);
        DB::unprepared($sql);
Or this:
 $path = 'app/someFolderForSQLFiles/topwords.sql';
 DB::unprepared(file_get_contents($path));
by Luka Tatarishvili
4 years ago
Laravel
Seeders
1
Pro tip: use ```triple backticks around text``` to write in code fences
0
გიორგი უზნაძე 4 years ago
va kaia amaze aqamde ar mifiqria prosta sql file-is public foldershi shenaxvas ar girchevdi bolo varianti jobia :D
REPLY
Show 1 reply