From 986f12f6853e2b587d317823ea5e5cb3d3700f4c Mon Sep 17 00:00:00 2001 From: twotalesanimation <80506065+twotalesanimation@users.noreply.github.com> Date: Fri, 2 Jan 2026 16:25:18 +0200 Subject: [PATCH] fix: Correct print stock relationship accessor - Change print_stocks (plural) to printStock (singular) - Properly accesses the PrintStock model via OrderItem's belongsTo relationship - Gets the correct print stock name from the print_stocks table --- app/Listeners/NotifySlackOnOrderCreated.php | 4 +++- config/trello.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Listeners/NotifySlackOnOrderCreated.php b/app/Listeners/NotifySlackOnOrderCreated.php index 8f54f3e..8a98da9 100644 --- a/app/Listeners/NotifySlackOnOrderCreated.php +++ b/app/Listeners/NotifySlackOnOrderCreated.php @@ -21,6 +21,7 @@ class NotifySlackOnOrderCreated // Extract design name from first order item's product $designName = $order->items->first()?->product?->name ?? '—'; + $printStock = $order->items->first()?->printStock?->name ?? '—'; // Calculate print size from first item's dimensions $printSize = '—'; @@ -29,7 +30,7 @@ class NotifySlackOnOrderCreated if ($firstItem->type === 'wallpaper' && $firstItem->length) { $printSize = $firstItem->length . 'm'; } elseif ($firstItem->type === 'mural' && $firstItem->width && $firstItem->height) { - $printSize = $firstItem->width . 'cm × ' . $firstItem->height . 'cm'; + $printSize = $firstItem->width . 'm × ' . $firstItem->height . 'm'; } } @@ -56,6 +57,7 @@ class NotifySlackOnOrderCreated // Populate custom fields with the same info $this->trello->setTextField($cardId, 'order_id', $order->uuid); $this->trello->setTextField($cardId, 'design_name', $designName); + $this->trello->setTextField($cardId, 'print_stock', $printStock); $this->trello->setTextField($cardId, 'customer_name', $order->customer_name ?? '—'); $this->trello->setTextField($cardId, 'print_size', $printSize); diff --git a/config/trello.php b/config/trello.php index 54370cf..c48aacd 100644 --- a/config/trello.php +++ b/config/trello.php @@ -26,7 +26,7 @@ return [ 'design_name' => '69579233dbdfa1de96beef7f', 'customer_name' => '6957924221e31eb4a7a271b0', 'print_size' => '6957926dab26ae511aaf17e9', - + 'print_stock' => '6957d40c8ad150b886b978e4', 'ship_w' => '6957929435cdaf8b318b16d5', 'ship_h' => '695792a3c5ef01fd66d9bb66', 'ship_l' => '695792bdba79b9499f0f5f59',