summaryrefslogtreecommitdiff
path: root/workbench/database
diff options
context:
space:
mode:
Diffstat (limited to 'workbench/database')
-rw-r--r--workbench/database/factories/ProductFactory.php5
-rw-r--r--workbench/database/migrations/2025_01_18_201725_create_products_table.php3
2 files changed, 6 insertions, 2 deletions
diff --git a/workbench/database/factories/ProductFactory.php b/workbench/database/factories/ProductFactory.php
index 4131cb2..081e196 100644
--- a/workbench/database/factories/ProductFactory.php
+++ b/workbench/database/factories/ProductFactory.php
@@ -27,7 +27,10 @@ class ProductFactory extends Factory
public function definition(): array
{
return [
- //
+ 'name' => fake()->text(30),
+ 'description' => fake()->text(100),
+ 'price' => fake()->randomFloat(2, 1, 300),
+ 'stock' => fake()->numberBetween(0, 30),
];
}
}
diff --git a/workbench/database/migrations/2025_01_18_201725_create_products_table.php b/workbench/database/migrations/2025_01_18_201725_create_products_table.php
index 7ee7127..4396485 100644
--- a/workbench/database/migrations/2025_01_18_201725_create_products_table.php
+++ b/workbench/database/migrations/2025_01_18_201725_create_products_table.php
@@ -14,8 +14,9 @@ return new class extends Migration
Schema::create('products', function (Blueprint $table) {
$table->id();
$table->string('name');
- $table->string('descripton');
+ $table->string('description');
$table->decimal('price', total: 8, places: 2);
+ $table->unsignedInteger('stock');
$table->timestamps();
$table->softDeletes();
});