| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | 
							- <?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('documents', function (Blueprint $table) {
 -             $table->id();
 -             $table->foreignId('company_id')->constrained()->cascadeOnDelete();
 -             $table->string('type'); // invoice, bill
 -             $table->string('document_number');
 -             $table->string('order_number')->nullable();
 -             $table->string('status'); // draft, sent, paid, cancelled, approved
 -             $table->dateTime('document_date');
 -             $table->dateTime('due_date');
 -             $table->dateTime('paid_date')->nullable();
 -             $table->decimal('amount', 15, 4);
 -             $table->foreignId('tax_id')->nullable()->constrained()->nullOnDelete();
 -             $table->foreignId('discount_id')->nullable()->constrained()->nullOnDelete();
 -             $table->string('reference')->nullable();
 -             $table->string('currency_code')->default('USD');
 -             $table->foreignId('category_id')->default(1)->constrained()->restrictOnDelete();
 -             $table->foreignId('contact_id')->nullable()->constrained()->nullOnDelete();
 -             $table->text('notes')->nullable();
 -             $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
 -             $table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
 -             $table->timestamps();
 - 
 -             $table->foreign('currency_code')->references('code')->on('currencies')->restrictOnDelete();
 -         });
 -     }
 - 
 -     /**
 -      * Reverse the migrations.
 -      */
 -     public function down(): void
 -     {
 -         Schema::dropIfExists('documents');
 -     }
 - };
 
 
  |