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
This commit is contained in:
@@ -21,6 +21,7 @@ class NotifySlackOnOrderCreated
|
|||||||
|
|
||||||
// Extract design name from first order item's product
|
// Extract design name from first order item's product
|
||||||
$designName = $order->items->first()?->product?->name ?? '—';
|
$designName = $order->items->first()?->product?->name ?? '—';
|
||||||
|
$printStock = $order->items->first()?->printStock?->name ?? '—';
|
||||||
|
|
||||||
// Calculate print size from first item's dimensions
|
// Calculate print size from first item's dimensions
|
||||||
$printSize = '—';
|
$printSize = '—';
|
||||||
@@ -29,7 +30,7 @@ class NotifySlackOnOrderCreated
|
|||||||
if ($firstItem->type === 'wallpaper' && $firstItem->length) {
|
if ($firstItem->type === 'wallpaper' && $firstItem->length) {
|
||||||
$printSize = $firstItem->length . 'm';
|
$printSize = $firstItem->length . 'm';
|
||||||
} elseif ($firstItem->type === 'mural' && $firstItem->width && $firstItem->height) {
|
} 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
|
// Populate custom fields with the same info
|
||||||
$this->trello->setTextField($cardId, 'order_id', $order->uuid);
|
$this->trello->setTextField($cardId, 'order_id', $order->uuid);
|
||||||
$this->trello->setTextField($cardId, 'design_name', $designName);
|
$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, 'customer_name', $order->customer_name ?? '—');
|
||||||
$this->trello->setTextField($cardId, 'print_size', $printSize);
|
$this->trello->setTextField($cardId, 'print_size', $printSize);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ return [
|
|||||||
'design_name' => '69579233dbdfa1de96beef7f',
|
'design_name' => '69579233dbdfa1de96beef7f',
|
||||||
'customer_name' => '6957924221e31eb4a7a271b0',
|
'customer_name' => '6957924221e31eb4a7a271b0',
|
||||||
'print_size' => '6957926dab26ae511aaf17e9',
|
'print_size' => '6957926dab26ae511aaf17e9',
|
||||||
|
'print_stock' => '6957d40c8ad150b886b978e4',
|
||||||
'ship_w' => '6957929435cdaf8b318b16d5',
|
'ship_w' => '6957929435cdaf8b318b16d5',
|
||||||
'ship_h' => '695792a3c5ef01fd66d9bb66',
|
'ship_h' => '695792a3c5ef01fd66d9bb66',
|
||||||
'ship_l' => '695792bdba79b9499f0f5f59',
|
'ship_l' => '695792bdba79b9499f0f5f59',
|
||||||
|
|||||||
Reference in New Issue
Block a user