Skip to content

Commit

Permalink
Update 2024_07_31_130241_add_brand_id_on_companies_table.php
Browse files Browse the repository at this point in the history
  • Loading branch information
zerossB authored Sep 10, 2024
1 parent 15544aa commit a14cc51
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ public function up(): void
$brandModel = app(config('hub.model_brand'));
$companyModel = app(config('hub.model_company'));

Schema::table($companyModel->getTable(), function (Blueprint $table) use ($brandModel) {
Schema::table($companyModel->getTable(), function (Blueprint $table) use ($brandModel, $companyModel) {
if (!Schema::hasColumn($companyModel->getTable(), 'main_company_id')) {
$table->foreignId('main_company_id')->nullable()->constrained($companyModel->getTable());
};

$table->after('main_company_id', function ($table) use ($brandModel) {
$table->foreignId('brand_id')->nullable()->constrained($brandModel->getTable());
});
Expand Down

0 comments on commit a14cc51

Please sign in to comment.