diff --git a/database/migrations/2026_07_16_000001_create_shipments_table.php b/database/migrations/2026_07_16_000001_create_shipments_table.php new file mode 100644 index 0000000..ffccb42 --- /dev/null +++ b/database/migrations/2026_07_16_000001_create_shipments_table.php @@ -0,0 +1,29 @@ +id(); + $table->foreignId('order_id')->constrained(config('lunar.database.table_prefix').'orders'); + $table->string('carrier'); + $table->string('tracking_reference')->unique(); + $table->string('parent_reference')->nullable(); + $table->timestamp('label_printed_at')->nullable(); + $table->string('manifest_reference')->nullable(); + $table->timestamp('cancelled_at')->nullable(); + $table->json('meta')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('shipments'); + } +}; diff --git a/src/Shipping/Models/Shipment.php b/src/Shipping/Models/Shipment.php new file mode 100644 index 0000000..368a110 --- /dev/null +++ b/src/Shipping/Models/Shipment.php @@ -0,0 +1,24 @@ + AsArrayObject::class, + 'label_printed_at' => 'datetime', + 'cancelled_at' => 'datetime', + ]; + + public function order(): BelongsTo + { + return $this->belongsTo(Order::class); + } +}