Skip to content

Commit aec8066

Browse files
committed
Update ProductController to handle is_only_wholesale attribute during product creation
This commit modifies the ProductController's store method to ensure the 'is_only_wholesale' attribute is correctly set based on the input during product creation. This enhancement improves the handling of product types and aligns with the recent updates to the Product model, ensuring accurate differentiation between wholesale and non-wholesale products.
1 parent c15f43e commit aec8066

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('category_atributes', function (Blueprint $table) {
15+
$table->id();
16+
$table->foreignId('category_id')->constrained()->onDelete('cascade');
17+
$table->foreignId('attribute_id')->constrained()->onDelete('cascade');
18+
$table->timestamps();
19+
});
20+
}
21+
22+
/**
23+
* Reverse the migrations.
24+
*/
25+
public function down(): void
26+
{
27+
Schema::dropIfExists('category_atributes');
28+
}
29+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::disableForeignKeyConstraints();
15+
Schema::create('category_atribute_group_links', function (Blueprint $table) {
16+
$table->id();
17+
$table->foreignId('category_attribute_id')->constrained()->onDelete('cascade');
18+
$table->foreignId('attribute_value_group_id')->constrained()->onDelete('cascade');
19+
$table->timestamps();
20+
});
21+
}
22+
23+
/**
24+
* Reverse the migrations.
25+
*/
26+
public function down(): void
27+
{
28+
Schema::dropIfExists('category_atribute_group_links');
29+
}
30+
};

0 commit comments

Comments
 (0)