id(); $table->unsignedBigInteger('farmer_id')->nullable(); $table->string('farmer_name')->nullable(); $table->unsignedBigInteger('offtaker_id')->nullable(); $table->string('offtaker_name')->nullable(); $table->string('commodity_name'); $table->double('quantity_kg')->default(0); $table->string('farmer_grade')->nullable(); $table->string('offtaker_grade')->nullable(); $table->text('grade_difference_reason')->nullable(); $table->double('price_per_kg')->default(0); $table->double('total_value')->default(0); $table->date('distribution_date')->nullable(); $table->date('received_date')->nullable(); $table->text('notes')->nullable(); $table->string('status')->nullable(); $table->string('sync_status')->default('pending'); // Audit Columns $table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null'); $table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null'); $table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null'); $table->timestamps(); // create_date & updated_date ditangani via timestamps $table->softDeletes(); }); } public function down(): void { Schema::dropIfExists('distributions'); } };