37 lines
960 B
PHP
37 lines
960 B
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('invoices', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('user_id')->constrained();
|
|
$table->foreignId('customer_id')->constrained();
|
|
$table->foreignId('address_id')->constrained();
|
|
$table->foreignId('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');
|
|
}
|
|
};
|