26 lines
524 B
PHP
26 lines
524 B
PHP
<?php
|
|
|
|
namespace Database\Seeders\Migrators;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use JsonMachine\Items;
|
|
|
|
class ActionEventsMigrator
|
|
{
|
|
public function migrate(): void
|
|
{
|
|
DB::table('action_events')->truncate();
|
|
|
|
$path = database_path('data/tested/action_events.json');
|
|
|
|
$items = Items::fromFile($path);
|
|
|
|
foreach ($items as $id => $item) {
|
|
if (! $item) {
|
|
continue;
|
|
}
|
|
|
|
DB::table('action_events')->insert((array) $item);
|
|
}
|
|
}
|
|
} |