Skip to content

Commit 68b3e42

Browse files
committed
Refactor order date accessor
1 parent c5da02f commit 68b3e42

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/Orders/OrderModel.php

+4-7
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,10 @@ public function orderDate(): Attribute
4848
{
4949
return Attribute::make(
5050
get: function () {
51-
try {
52-
$order = OrderFacade::find($this->id);
53-
54-
return $order->statusLog()->where('status', OrderStatus::Placed)->map->date()->last();
55-
} catch (OrderNotFound $e) {
56-
return Carbon::now();
57-
}
51+
return $this->statusLog()
52+
->where('status', OrderStatus::Placed)
53+
->map->date()
54+
->last();
5855
},
5956
);
6057
}

0 commit comments

Comments
 (0)