Refactor VisaMasterPaymentOrder components and enhance seeding process
- Updated record title attribute in VisaMasterPaymentOrderResource to 'unique_id'. - Improved schema layout in VisaMasterPaymentOrderForm and VisaMasterPaymentOrderInfolist for better user experience. - Added 'unique_id' field to VisaMasterPaymentOrderInfolist with styling adjustments. - Implemented BelongsToBranch interface in VisaMasterPaymentOrder model and added a boot method for loan order creation. - Expanded FillJsonData seeder to include migration for VisaMasterPaymentOrders.
This commit is contained in:
@@ -11,6 +11,7 @@ class FillJsonData extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->seedVisaMasterPaymentOrders();
|
||||
}
|
||||
|
||||
protected function seedUsers(): void
|
||||
@@ -62,4 +63,9 @@ class FillJsonData extends Seeder
|
||||
{
|
||||
(new Migrators\CardPinOrdersMigrator)->migrate();
|
||||
}
|
||||
|
||||
protected function seedVisaMasterPaymentOrders(): void
|
||||
{
|
||||
(new Migrators\VisaMasterPaymentOrdersMigrator)->migrate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders\Migrators;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use JsonMachine\JsonMachine;
|
||||
use JsonMachine\Items;
|
||||
|
||||
class VisaMasterPaymentOrdersMigrator
|
||||
{
|
||||
public function migrate(): void
|
||||
{
|
||||
DB::table('visa_master_payment_orders')->truncate();
|
||||
|
||||
$path = database_path('data/nurmuhammetsdb/visa_master_payment_orders.json');
|
||||
|
||||
$items = Items::fromFile($path);
|
||||
|
||||
foreach ($items as $id => $item) {
|
||||
if (! $item) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* "id": 5,
|
||||
"unique_id": "TB1304-5",
|
||||
"type": "visa",
|
||||
"passport_name": "Döwran",
|
||||
"passport_surname": "Myratlyýew",
|
||||
"phone": "+(993)-65-87-59-99",
|
||||
"email": null,
|
||||
"region": "ag",
|
||||
"branch_id": 5,
|
||||
"user_id": 3,
|
||||
"address": "Aşgabat ş. A.Gowşudow, 57, 2",
|
||||
"sender_datas": "[{\"passport_serie\":\"I-AH\",\"passport_number\":144505,\"full_name\":\"D\\u00f6wran Myratly\\u00fdew\"}]",
|
||||
"payment_reciever": "[{\"passport_serie\":\"II-AH\",\"passport_number\":121445,\"full_name\":\"Kerimberdi Myratly\\u00fdew\"}]",
|
||||
"documents": null,
|
||||
"status": "processing",
|
||||
"notes": null,
|
||||
"created_at": "2024-09-24 19:34:35",
|
||||
"updated_at": "2024-11-24 15:12:04",
|
||||
"paid": true,
|
||||
"deleted_at": "2024-11-24 15:12:04",
|
||||
"sender_full_name": null,
|
||||
"sender_passport_serie": null,
|
||||
"sender_passport_number": null,
|
||||
"sender_deposit_account": null
|
||||
*/
|
||||
|
||||
DB::table('loan_orders')->insert((array) $item);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user