Compare commits

..

1 Commits

Author SHA1 Message Date
edmondlang 1578085bab add attached timestamp 2023-12-30 16:55:45 +08:00
11 changed files with 10 additions and 16 deletions
@@ -20,7 +20,7 @@ class AssignsAnnouncementToSegment extends AbstractUpdateRecord
{
try {
$announcement->segments()->attach($segment);
$announcement->segments()->attach($segment, ['created_at' => now(), 'updated_at' => now()]);
return $announcement;
@@ -20,7 +20,7 @@ class AssignsCompanyConnectionToConnectionSegment extends AbstractUpdateRecord
{
try {
$companyConnection->segments()->attach($segment);
$companyConnection->segments()->attach($segment, ['created_at' => now(), 'updated_at' => now()]);
return $companyConnection;
@@ -22,7 +22,7 @@ class AssignsCompanyToSegment extends AbstractUpdateRecord
try {
$companyModule = $company->companyModules()->where('type', BusinessType::IMPORTER)->first();
$connection = $companyModule->connections()->where('inviter_reference', 'CIEF');
$connection->segments()->attach($segment);
$connection->segments()->attach($segment, ['created_at' => now(), 'updated_at' => now()]);
return $company;
@@ -18,7 +18,7 @@ class AssignsEmployee extends AbstractUpdateRecord
{
try {
$object->getCompanyModule()->employees()->attach($object->getUser(), ['status' => $object->getStatus(),'role_id' => $object->getRoleId()]);
$object->getCompanyModule()->employees()->attach($object->getUser(), ['status' => $object->getStatus(), 'role_id' => $object->getRoleId(), 'created_at' => now(), 'updated_at' => now()]);
return $object->getCompanyModule();
@@ -53,7 +53,7 @@ class AssignPackingListContainerLogic extends AbstractControllerLogic
foreach ($packing_list as $key => $row) {
$packing_list_item = $this->fetchesPackingList->execute(['id' => $row]);
$container->packingLists()->attach($packing_list_item);
$container->packingLists()->attach($packing_list_item, ['created_at' => now(), 'updated_at' => now()]);
}
return $this->resourceResponse(new ContainerResource($container));
@@ -129,7 +129,7 @@ class FetchContainersFromYdPortalProcessor
try {
$container = $this->fetchesContainer->execute(['reference' => $containerReference]);
$container->packingLists()->detach($packingList);
$container->packingLists()->attach($packingList);
$container->packingLists()->attach($packingList, ['created_at' => now(), 'updated_at' => now()]);
} catch (ResourceNotFoundException $exception){
if(!($packingList->owner instanceof Order)) continue;
@@ -143,7 +143,7 @@ class FetchContainersFromYdPortalProcessor
$container = $this->createContainerProcessor->execute($containerObject, $originWarehouse);
$container->packingLists()->detach($packingList);
$container->packingLists()->attach($packingList);
$container->packingLists()->attach($packingList, ['created_at' => now(), 'updated_at' => now()]);
if(config('perfexcrm.is_enabled') == 'true'){
$this->packingListToPerfexCRMProcessor->execute($packingList, PerfexCRMTasksYDStages::LOAD_CONTAINER);
@@ -274,7 +274,7 @@ class FetchLoadedContainersFromVTPortalProcessor
}
$container->packingLists()->detach($packingList);
$container->packingLists()->attach($packingList);
$container->packingLists()->attach($packingList, ['created_at' => now(), 'updated_at' => now()]);
$packingList->packages()->delete();
$replica = $packingList->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST_REPLICA)->first();
@@ -385,7 +385,7 @@ class FetchOrderListsFromYdPortalProcessor
try {
$container = $this->fetchesContainer->execute(['reference' => $containerReference]);
$container->packingLists()->detach($packingList);
$container->packingLists()->attach($packingList);
$container->packingLists()->attach($packingList, ['created_at' => now(), 'updated_at' => now()]);
} catch (ResourceNotFoundException $exception){
if (!$allow_contract) {
@@ -37,7 +37,6 @@ class MappableTransactionResource extends JsonResource
'owner_type' => Transaction::class,
'owner_id'=> $this->id,
'owner_reference'=> $reference,
'created_at'=> $this->created_at, // invoice date
];
}
}
@@ -27,19 +27,16 @@ class MappableTransactionWithDetailsResource extends JsonResource
'order_reference' => null,
'bill_no' => null,
'marking' => null,
'created_at' => null
];
if ($this->type === TransactionType::PAYMENT) {
$order = $this->owner->owner->owner;
$data['order_reference'] = $order->reference;
$data['debtor_code'] = $order->companyModule->company->debtor;
$data['created_at'] = $this->owner->created_at; // invoice date
} elseif (in_array($this->type, [TransactionType::GROUP_PAYMENT, TransactionType::TOP_UP])) {
$connection = $this->owner->owner->inviters()->withPivot('invitee_reference')->first();
$data['marking'] = $connection ? $connection->pivot->invitee_reference : '';
$data['bill_no'] = $this->bill_no;
$data['created_at'] = $this->created_at;
} else {
$payments = $this->transactions()
->payments()->where('status', ApprovalStatus::APPROVED)
@@ -57,7 +54,6 @@ class MappableTransactionWithDetailsResource extends JsonResource
'type' => $payment->type,
'marking' => null,
'amount' => $payment->amount,
'created_at' => $this->created_at
];
})->toArray();
} else {
@@ -65,7 +61,6 @@ class MappableTransactionWithDetailsResource extends JsonResource
$data['amount'] = 'Transaction Type not allowed';
$data['transaction_type'] = $this->type;
$data['payment_transactions'] = null;
$data['created_at'] = null;
}
}
+1 -1
View File
@@ -531,7 +531,7 @@ class DummyDataSeeder extends Seeder
$container = $this->faker->randomElement(Container::whereDate('loading_date', '>=', $receiveDate)->get());
// attach packing list to container
$container->packingLists()->attach($shippingPackingList);
$container->packingLists()->attach($shippingPackingList, ['created_at' => now(), 'updated_at' => now()]);
if ($container->status !== ApprovalStatus::COMPLETED) {
// ==== //