- Added "halaxa/json-machine" dependency to composer.json. - Updated content hash in composer.lock to reflect changes. - Improved SpatieMediaLibraryFileEntry component documentation. - Expanded FillJsonData seeder to include new migrators for card types, orders, and pin orders. - Updated Tailwind CSS version in app.css. - Refactored various JavaScript components for better performance and readability. - Added a test route in web.php for debugging purpose
32 lines
718 B
PHP
32 lines
718 B
PHP
<?php
|
|
|
|
namespace Database\Seeders\Migrators;
|
|
|
|
use JsonMachine\JsonMachine;
|
|
use JsonMachine\Items;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\File;
|
|
use Illuminate\Support\LazyCollection;
|
|
use Cerbero\LazyJson\LazyJson;
|
|
|
|
class LoanOrdersMigrator
|
|
{
|
|
public function migrate(): void
|
|
{
|
|
// Running on seeder file, may not work.
|
|
|
|
DB::table('loan_orders')->truncate();
|
|
|
|
$path = database_path('data/nurmuhammetsdb/loan_orders.json');
|
|
|
|
$items = Items::fromFile($path);
|
|
|
|
foreach ($items as $id => $item) {
|
|
if (! $item) {
|
|
continue;
|
|
}
|
|
|
|
DB::table('loan_orders')->insert((array) $item);
|
|
}
|
|
}
|
|
} |