hasTable('bus')) { Capsule::schema()->create('bus', function (Blueprint $table) { $table->increments('bus_id'); $table->string('bus_name'); $table->string('bus_slug')->unique(); $table->text('bus_description')->nullable(); $table->string('bus_logo')->nullable(); $table->string('bus_business_card')->nullable(); $table->string('bus_document')->nullable(); $table->string('bus_email')->nullable(); $table->string('bus_phone')->nullable(); $table->string('bus_address')->nullable(); $table->string('bus_city')->nullable(); $table->string('bus_state')->nullable(); $table->string('bus_country')->nullable(); $table->string('bus_postal_code')->nullable(); $table->string('bus_website')->nullable(); $table->string('bus_tax_id')->nullable(); $table->string('bus_type')->nullable(); // e.g., 'personal', 'business' $table->enum('bus_status', ['active', 'inactive', 'suspended'])->default('active'); $table->json('bus_settings')->nullable(); $table->timestamps(); $table->softDeletes(); }); } // Company Modules Pivot Table if (!Capsule::schema()->hasTable('bus_modules')) { Capsule::schema()->create('bus_modules', function (Blueprint $table) { $table->increments('bus_modules_id'); $table->integer('bus_modules_bus_id')->unsigned(); $table->integer('bus_modules_module_id')->unsigned(); $table->boolean('bus_modules_is_enabled')->default(true); $table->json('bus_modules_settings')->nullable(); $table->integer('bus_modules_enabled_by')->unsigned()->nullable(); $table->timestamp('bus_modules_enabled_at')->useCurrent(); // Navigation visibility $table->boolean('bus_modules_show_public_nav')->default(true); $table->boolean('bus_modules_show_dashboard_nav')->default(true); $table->timestamps(); $table->unique(['bus_modules_bus_id', 'bus_modules_module_id']); $table->foreign('bus_modules_bus_id')->references('bus_id')->on('bus')->onDelete('cascade'); // Note: modules table is created in SystemConfig or Core, so we might need to be careful with foreign keys if order varies. // Assuming modules table exists or will exist. If strict, we can add FK. // $table->foreign('bus_modules_module_id')->references('modules_id')->on('modules')->onDelete('cascade'); }); } } public function down() { Capsule::schema()->dropIfExists('bus_modules'); Capsule::schema()->dropIfExists('bus'); } }