Skip to content

Commit

Permalink
fix update the upselling table struct
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Jul 23, 2024
1 parent 1eb408c commit 913c013
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,23 @@ public function up(): void
//
Schema::create('upselling_rules', function (Blueprint $table) {
$table->increments('id');
$table->string('name');

$table->chat('name', 255)->comment('name of the rule');
$table->string('description')->comment('description of the rule')->nullable();
$table->chat('type', 50)->comment("type of the rule");
$table->tinyInteger('status')->default(1)->comment('status of the rule');
$table->string('conditions_type', 50)->comment("conditions rules type 'product', 'category', 'quantity', 'weight', 'price', 'customer', 'cart', 'time', 'date', 'day', 'month', 'year'");
$table->string('condition_value', 255)->comment("conditions rules value ID or value based on the condition_type");
$table->string('rule_type', 50)->comment("type of the rule 'fixed', 'percentage', 'bundle', 'tiered', 'dynamic'");
$table->decimal('discount', 10, 4)->default(0)->comment('discount of the rule');
$table->json('conditions')->nullable()->comment('conditions rules');
$table->float('discount', 8, 4)->default(0)->comment('discount of the rule');
$table->tinyInteger('sort_order')->default(0)->comment('sort order');
$table->tinyInteger('is_end')->default(0)->comment('is end of the rule');


// $table->string('description')->comment('description of the rule')->nullable();
// $table->chat('type', 50)->comment("type of the rule");
// $table->tinyInteger('status')->default(1)->comment('status of the rule');
// $table->json('conditions')->nullable()->comment('conditions rules');
// $table->float('discount', 8, 4)->default(0)->comment('discount of the rule');
// $table->tinyInteger('sort_order')->default(0)->comment('sort order');
// $table->tinyInteger('is_end')->default(0)->comment('is end of the rule');
$table->timestamps();
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('upselling_products', function (Blueprint $table) {
$table->id();
$table->tinyInteger('discount_type')->comment('The type of discount that is applied to the upselling product');
$table->decimal('discount_value', 10, 4)->comment('The value of the discount that is applied to the upselling product')->default(0.0000);
$table->unsignedBigInteger('upselling_product_id')->comment('The ID of the upselling product');
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
$table->unsignedBigInteger('product_id')->comment('The ID of the product that is being upsold');
$table->tinyInteger('status')->comment('The status of the upselling product')->default(1);
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('upselling_products');
}
};
4 changes: 4 additions & 0 deletions src/Http/Controllers/Admin/ProductsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ class ProductsController extends Controller
{
public function index()
{

//


return view('Upselling::Admin.products.index');
}

Expand Down
1 change: 0 additions & 1 deletion src/Http/Controllers/Admin/SettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class SettingController extends Controller
{
// redirect to configuration page
public function index() {

return Redirect::route('admin.configuration.index', ( 'apps/' . 'Upselling'));
}
}

0 comments on commit 913c013

Please sign in to comment.