Files
tbbank-new/database/seeders/Migrators/LoanOrdersMigrator.php
Mekan1206 4fc242bc7d Update dependencies and enhance components
- 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
2025-12-21 02:41:27 +05:00

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);
}
}
}