id(); $table->foreignId('company_id')->constrained()->cascadeOnDelete(); $table->string('type')->nullable(); $table->string('name'); $table->string('email'); $table->string('address', 255)->nullable(); $table->unsignedMediumInteger('city_id')->nullable()->index(); $table->string('zip_code', 20)->nullable(); $table->string('state')->nullable(); $table->string('country')->nullable(); $table->string('timezone')->nullable(); $table->string('language')->nullable(); $table->string('contact_method')->nullable(); $table->string('phone_number', 30)->nullable(); $table->string('tax_id', 50)->nullable(); $table->string('currency_code', 10)->nullable(); $table->string('website', 255)->nullable(); $table->string('reference', 255)->nullable(); $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete(); $table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete(); $table->timestamps(); $table->index(['company_id', 'type']); $table->unique(['company_id', 'type', 'email']); $table->foreign('currency_code')->references('code')->on('currencies')->nullOnDelete(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('contacts'); } };