diff --git a/app/Models/Address.php b/app/Models/Address.php new file mode 100644 index 0000000..7e4ccfe --- /dev/null +++ b/app/Models/Address.php @@ -0,0 +1,11 @@ +id(); + + $table->string('name'); + $table->string('email')->unique(); + + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('customers'); + } +}; diff --git a/database/migrations/2024_11_25_161729_create_addresses_table.php b/database/migrations/2024_11_25_161729_create_addresses_table.php new file mode 100644 index 0000000..c14419f --- /dev/null +++ b/database/migrations/2024_11_25_161729_create_addresses_table.php @@ -0,0 +1,38 @@ +id(); + $table->foreignId('user_id')->constrained(); + + $table->string('name'); + $table->string('email')->nullable(); + $table->string('phone')->nullable(); + $table->string('address')->nullable(); + $table->string('city')->nullable(); + $table->string('state')->nullable(); + $table->string('zip')->nullable(); + $table->string('country')->nullable(); + + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('addresses'); + } +}; diff --git a/database/migrations/2024_11_25_162738_create_invoices_table.php b/database/migrations/2024_11_25_162738_create_invoices_table.php new file mode 100644 index 0000000..a3ba443 --- /dev/null +++ b/database/migrations/2024_11_25_162738_create_invoices_table.php @@ -0,0 +1,36 @@ +id(); + $table->foreignId('user_id')->constrained(); + $table->foreignId('customer_id')->constrained(); + $table->foreignId('address_id')->constrained(); + $table->foreign('delivery_id')->references('id')->on('addresses'); + + $table->string('invoice_number'); + $table->string('type'); // Map to external formats + $table->string('status'); // Open, payed ... + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('invoices'); + } +}; diff --git a/database/migrations/2024_11_25_163628_create_invoiceitems_table.php b/database/migrations/2024_11_25_163628_create_invoiceitems_table.php new file mode 100644 index 0000000..625abcf --- /dev/null +++ b/database/migrations/2024_11_25_163628_create_invoiceitems_table.php @@ -0,0 +1,35 @@ +id(); + $table->foreignId('invoice_id')->constrained(); + + $table->decimal('amount', 8, 2); + $table->decimal('discount', 8, 2); + $table->decimal('tax', 8, 2); + $table->decimal('price', 8, 2); + $table->decimal('total', 8, 2); + + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('invoiceitems'); + } +}; diff --git a/database/migrations/2024_11_25_164059_create_payments_table.php b/database/migrations/2024_11_25_164059_create_payments_table.php new file mode 100644 index 0000000..2072a47 --- /dev/null +++ b/database/migrations/2024_11_25_164059_create_payments_table.php @@ -0,0 +1,34 @@ +id(); + $table->foreignId('invoice_id')->constrained(); + + $table->decimal('paid_amount', 15, 2); + $table->string('status'); + $table->string('payment_method')->nullable(); + + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('payments'); + } +};