mirror of
https://gitlab.com/uldvstar/exchange-2.0.git
synced 2026-08-19 04:24:16 +00:00
clean up development
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\Transaction;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
|
||||
@@ -17,18 +18,22 @@ class UpdateTransactionBillOwnerSeeder extends Seeder
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
$transaction = Transaction::where('type', TransactionType::BILL)->get();
|
||||
$bookings = Booking::all();
|
||||
|
||||
foreach ($transaction as $key => $row) {
|
||||
$key = 0;
|
||||
$bills = $row->booking->transactions()->bills()->where('original_amount', '=', $row->original_amount)->get();
|
||||
if(count($bills) > 1){ $key = $bills->search(function($bill)use($row){ return $bill->id === $row->id; }); }
|
||||
$paymentTransaction = $row->booking->transactions()->payments()->complete()->where('original_amount', '=', $row->original_amount)->skip($key)->first();
|
||||
foreach ($bookings as $booking) {
|
||||
|
||||
$row->owner_type = Transaction::class;
|
||||
$row->owner_id = $paymentTransaction->id;
|
||||
$row->updated_at = $row->updated_at;
|
||||
$row->update();
|
||||
$transactions = $booking->transactions()->bills()->get();
|
||||
foreach ($transactions as $row) {
|
||||
$key = 0;
|
||||
$bills = $booking->transactions()->bills()->where('original_amount', '=', $row->original_amount)->get();
|
||||
if(count($bills) > 1){ $key = $bills->search(function($bill)use($row){ return $bill->id === $row->id; }); }
|
||||
$paymentTransaction = $booking->transactions()->payments()->complete()->where('original_amount', '=', $row->original_amount)->skip($key)->first();
|
||||
|
||||
$row->owner_type = Transaction::class;
|
||||
$row->owner_id = $paymentTransaction->id;
|
||||
$row->updated_at = $row->updated_at;
|
||||
$row->update();
|
||||
}
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
|
||||
Reference in New Issue
Block a user