fix: Add datetime casts to Order model and null check in view

- Add casts array to Order model for packing_completed_at, delivered_at, qr_generated_at
- Update ops order-detail view to safely handle null packing_completed_at
- Prevents 'Call to a member function format() on string' error
This commit is contained in:
twotalesanimation
2026-01-02 21:29:12 +02:00
parent 22dfb12948
commit 027278c216
2 changed files with 12 additions and 1 deletions
+11
View File
@@ -46,6 +46,17 @@ class Order extends Model
'qr_generated_at',
];
protected function casts(): array
{
return [
'packing_completed_at' => 'datetime',
'delivered_at' => 'datetime',
'qr_generated_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
}
public function user()
{
return $this->belongsTo(User::class);