Add price and product models

This commit is contained in:
Krzysztof Płaczek
2024-03-26 12:42:06 +01:00
parent 5dc1c9d9f0
commit b4536e4c6b
6 changed files with 100 additions and 36 deletions

View File

@@ -17,11 +17,12 @@ $capsule->addConnection([
]);
$capsule->setAsGlobal();
if (!Capsule::schema()->hasTable('product')) {
Capsule::schema()->create('product', function (Blueprint $table) {
if (!Capsule::schema()->hasTable('products')) {
Capsule::schema()->create('products', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('skuID');
$table->integer('skuID')->unique();
$table->integer('agilityID');
$table->integer('availableQuantity');
$table->integer('stock');
$table->json('categories');
@@ -35,8 +36,8 @@ if (!Capsule::schema()->hasTable('product')) {
}
if (!Capsule::schema()->hasTable('price')) {
Capsule::schema()->create('price', function (Blueprint $table) {
if (!Capsule::schema()->hasTable('prices')) {
Capsule::schema()->create('prices', function (Blueprint $table) {
$table->increments('id');
$table->foreignId('product_id');
$table->float('price');