Skip to content

Instantly share code, notes, and snippets.

@jongravois
Created July 28, 2020 21:45
Show Gist options
  • Save jongravois/b32869430202d4336ef85d8935de1105 to your computer and use it in GitHub Desktop.
Save jongravois/b32869430202d4336ef85d8935de1105 to your computer and use it in GitHub Desktop.
<?php
use App\Models\DealFin;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
class DealsFinSeeder extends Seeder
{
public function run()
{
DB::table('deal_fins')->delete();
$json = File::get("database/json/deal_fins.json");
$data = json_decode($json, true);
foreach($data as $obj) {
DealFin::create($obj);
} // end foreach
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment