From ad1c06ee1819b3512e2443d5cbe06199a0ae9bad Mon Sep 17 00:00:00 2001 From: Sam Light Date: Tue, 10 Feb 2026 00:21:10 +0000 Subject: Created order tables and models --- workbench/app/Enums/OrderStatus.php | 11 ++++++++ workbench/app/Models/Order.php | 51 +++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 workbench/app/Enums/OrderStatus.php create mode 100644 workbench/app/Models/Order.php (limited to 'workbench/app') diff --git a/workbench/app/Enums/OrderStatus.php b/workbench/app/Enums/OrderStatus.php new file mode 100644 index 0000000..555e31a --- /dev/null +++ b/workbench/app/Enums/OrderStatus.php @@ -0,0 +1,11 @@ + + */ + use HasFactory; + + /** + * @return OrderFactory + */ + protected static function newFactory(): OrderFactory + { + return OrderFactory::new(); + } + + /** + * @return array + */ + protected function casts(): array + { + return [ + 'status' => OrderStatus::class, + ]; + } + + /** + * @return BelongsToMany + */ + public function products(): BelongsToMany + { + return $this->belongsToMany(Product::class)->withPivot('quantity', 'price')->withTimestamps(); + } +} -- cgit v1.2.3