Catalog rules migrations finalized

This commit is contained in:
Prashant Singh 2019-08-08 07:28:08 +05:30
parent bb12e07212
commit 6d41d37c3b
7 changed files with 59 additions and 19 deletions

View File

@ -188,15 +188,13 @@ return [
'route' => 'admin.cart-rule.index',
'sort' => 1,
'icon-class' => '',
],
// , [
// 'key' => 'promotions.catalog-rule',
// 'name' => 'admin::app.promotion.catalog-rule',
// 'route' => 'admin.catalog-rule.index',
// 'sort' => 1,
// 'icon-class' => '',
// ]
[
], [
'key' => 'promotions.catalog-rule',
'name' => 'admin::app.promotion.catalog-rule',
'route' => 'admin.catalog-rule.index',
'sort' => 1,
'icon-class' => '',
], [
'key' => 'cms',
'name' => 'admin::app.layouts.cms',
'route' => 'admin.cms.index',

View File

@ -95,7 +95,7 @@
<div class="control-group" :class="[errors.has('starts_from') ? 'has-error' : '']">
<label for="starts_from" class="required">{{ __('admin::app.promotion.general-info.starts-from') }}</label>
<input type="text" class="control" v-model="starts_from" name="starts_from" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.starts-from') }}&quot;">
<input type="text" class="control" v-model="starts_from" name="starts_from" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.starts-from') }}&quot;">
<span class="control-error" v-if="errors.has('starts_from')">@{{ errors.first('starts_from') }}</span>
</div>
@ -105,7 +105,7 @@
<div class="control-group" :class="[errors.has('ends_till') ? 'has-error' : '']">
<label for="ends_till" class="required">{{ __('admin::app.promotion.general-info.ends-till') }}</label>
<input type="text" class="control" v-model="ends_till" name="ends_till" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.ends-till') }}&quot;">
<input type="text" class="control" v-model="ends_till" name="ends_till" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.ends-till') }}&quot;">
<span class="control-error" v-if="errors.has('ends_till')">@{{ errors.first('ends_till') }}</span>
</div>

View File

@ -22,10 +22,9 @@ class CreateCatalogRulesTable extends Migration
$table->boolean('status')->default(0);
$table->json('conditons')->nullable();
$table->json('actions')->nullable();
$table->boolean('end_other_rules')->default(1);
$table->integer('sort_order')->unsigned()->default(0);
$table->string('action');
$table->decimal('discount_amount', 12, 4)->default(0);
$table->boolean('end_other_rules')->default(0);
$table->string('action_code')->nullable();
$table->decimal('discount_amount', 20, 4)->default(0.0000);
$table->timestamps();
});
}

View File

@ -14,7 +14,7 @@ class CreateCatalogRuleProductsTable extends Migration
public function up()
{
Schema::create('catalog_rule_products', function (Blueprint $table) {
$table->increments('id');
$table->bigIncrements('id');
$table->integer('catalog_rule_id')->unsigned();
$table->foreign('catalog_rule_id')->references('id')->on('catalog_rules')->onDelete('cascade');
$table->datetime('starts_from')->nullable();
@ -23,9 +23,10 @@ class CreateCatalogRuleProductsTable extends Migration
$table->foreign('customer_group_id')->references('id')->on('customer_groups')->onDelete('cascade');
$table->integer('channel_id')->unsigned();
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
$table->string('action_operator')->nullable();
$table->decimal('action_amount', 12, 4)->default(0);
$table->decimal('price', 12, 4)->default(0);
$table->integer('product_id')->unsigned();
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
$table->string('action_code')->nullable();
$table->decimal('action_amount', 20, 4)->default(0.0000);
$table->timestamps();
});
}

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCatalogRuleProductPriceTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('catalog_rule_product_price', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('channel_id')->unsigned();
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
$table->integer('customer_group_id')->unsigned();
$table->foreign('customer_group_id')->references('id')->on('customer_groups')->onDelete('cascade');
$table->integer('product_id')->unsigned();
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
$table->integer('catalog_rule_id')->unsigned();
$table->foreign('catalog_rule_id')->references('id')->on('catalog_rules')->onDelete('cascade');
$table->decimal('rule_price', 20, 4)->default(0.0000);
$table->datetime('starts_from')->nullable();
$table->datetime('ends_till')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('catalog_rule_product_price');
}
}