Created
July 28, 2020 21:45
-
-
Save jongravois/b32869430202d4336ef85d8935de1105 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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