Fixed issue #1543 and Cart rule related issues
This commit is contained in:
parent
3046662d45
commit
832c845091
|
|
@ -40,8 +40,8 @@ class CreateAttributeGroupsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('attribute_groups');
|
||||
|
||||
Schema::dropIfExists('attribute_group_mappings');
|
||||
|
||||
Schema::dropIfExists('attribute_groups');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class AddSwatchTypeColumnInAttributesTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('attributes', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('swatch_type');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class AddSwatchValueColumnsInAttributeOptionsTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('attribute_options', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('swatch_value');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class AddUseInFlatColumnInAttributesTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('attributes', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('use_in_flat');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class AddDisplayModeColumnInCategoriesTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('categories', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('display_mode');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ class AddLocaleIdInCategoryTranslations extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
Schema::table('category_translations', function (Blueprint $table) {
|
||||
$table->dropForeign(['locale_id']);
|
||||
|
||||
$table->dropColumn('locale_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class UpdateZipcodeColumnTypeToVarcharInCartAddressTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('cart_address', function (Blueprint $table) {
|
||||
//
|
||||
$table->integer('postcode')->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ class RenameDiscountColumnsInCartTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('cart', function (Blueprint $table) {
|
||||
//
|
||||
$table->renameColumn('discount_amount', 'discount');
|
||||
$table->renameColumn('base_discount_amount', 'base_discount');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,12 @@ class UpdateCustomPriceToNullableInCartItems extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
Schema::table('cart_items', function (Blueprint $table) {
|
||||
$table->dropColumn('custom_price');
|
||||
});
|
||||
|
||||
Schema::table('cart_items', function (Blueprint $table) {
|
||||
$table->decimal('custom_price', 12,4)->default(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class UpdateWeightColumnDeafultValueInCartItemsTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('cart_items', function (Blueprint $table) {
|
||||
//
|
||||
$table->decimal('weight', 12,4)->default(1)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,8 +56,10 @@ class CreateChannelsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('channels');
|
||||
|
||||
Schema::dropIfExists('channel_currencies');
|
||||
|
||||
Schema::dropIfExists('channel_locales');
|
||||
|
||||
Schema::dropIfExists('channels');
|
||||
}
|
||||
}
|
||||
|
|
@ -25,8 +25,6 @@ class ChangeContentColumnInSlidersTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('sliders', function (Blueprint $table) {
|
||||
$table->string('content')->change();
|
||||
});
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,6 @@ class DropForeignKeyCoreConfigTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('core_config', function (Blueprint $table) {
|
||||
$table->dropForeign('core_config_channel_id_foreign');
|
||||
$table->renameColumn('channel_id', 'channel_code');
|
||||
});
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,10 +27,6 @@ class AlterCoreConfigTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('core_config', function (Blueprint $table) {
|
||||
$table->string('channel_code')->nullable()->change();
|
||||
$table->string('locale_code')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,6 @@ class UpdateValueColumnTypeToTextInCoreConfigTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class AddSymbolColumnInCurrenciesTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('currencies', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('symbol');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ class AlterLocalesTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
Schema::table('locales', function (Blueprint $table) {
|
||||
$table->dropColumn('direction');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ class AddIsVerifiedColumnInCustomersTable extends Migration
|
|||
public function up()
|
||||
{
|
||||
Schema::table('customers', function (Blueprint $table) {
|
||||
$table->boolean('is_verified')->default(0)->after('subscribed_to_news_letter');
|
||||
$table->string('token')->nullable()->after('is_verified');
|
||||
$table->boolean('is_verified')->default(0);
|
||||
$table->string('token')->nullable();
|
||||
$table->dropColumn('gender');
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ class AddNotesColumnInCustomersTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('customers', function (Blueprint $table) {
|
||||
$table->dropColumn('notes');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@ class AddPhoneColumnInCustomersTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('customers', function (Blueprint $table) {
|
||||
//
|
||||
if (Schema::hasColumn('customers', 'phone')) {
|
||||
$table->dropColumn('phone');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class AddCodeColumnInCustomerGroupsTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('customer_groups', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('code');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@ class RemoveUniqueInPhoneColumnInCustomersTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('customers', function (Blueprint $table) {
|
||||
//
|
||||
if ( Schema::hasColumn('customers', 'phone')) {
|
||||
$table->unique('phone');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class AddAdditionalCloumnInWishlistTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('wishlist', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('additional');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,38 +31,38 @@ abstract class Action
|
|||
*
|
||||
* @return Collection $matchedItems
|
||||
*/
|
||||
public function getEligibleItems($rule)
|
||||
public function getEligibleItems()
|
||||
{
|
||||
$rule = $this->rule;
|
||||
|
||||
$cart = \Cart::getCart();
|
||||
|
||||
$items = $cart->items()->get();
|
||||
|
||||
$productIDs = $rule->product_ids;
|
||||
if ($this->rule->action_type == 'whole_cart_to_percent' || $this->rule->action_type == 'whole_cart_to_fixed_amount') {
|
||||
$this->matchedItems = $items;
|
||||
}
|
||||
|
||||
$productIDs = explode(',', $productIDs);
|
||||
|
||||
$matchCriteria = $rule->uses_attribute_conditions ? $rule->product_ids : '*';
|
||||
|
||||
if ($matchCriteria == '*') {
|
||||
if (! $rule->uses_attribute_conditions) {
|
||||
$this->matchedItems = $items;
|
||||
|
||||
return $this->matchedItems;
|
||||
} else {
|
||||
$matchingIDs = explode(',', $matchCriteria);
|
||||
$productIDs = explode(',', $rule->product_ids);
|
||||
|
||||
foreach ($items as $item) {
|
||||
foreach ($matchingIDs as $matchingID) {
|
||||
foreach ($productIDs as $productID) {
|
||||
$childrens = collect();
|
||||
$childrens = $item->children;
|
||||
|
||||
foreach ($childrens as $children) {
|
||||
if ($children->product_id == $matchingID) {
|
||||
$this->pushItem($children);
|
||||
if ($children->product_id == $productID) {
|
||||
$this->matchedItems->push($children);
|
||||
}
|
||||
}
|
||||
|
||||
if ($item->product_id == $matchingID) {
|
||||
$this->pushItem($item);
|
||||
if ($item->product_id == $productID) {
|
||||
$this->matchedItems->push($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -85,11 +85,11 @@ abstract class Action
|
|||
return true;
|
||||
} else {
|
||||
if ($rule->action_type == 'whole_cart_to_percent' && $rule->uses_attribute_condition) {
|
||||
$matchIDs = explode(',', $rule->product_ids);
|
||||
$matchingIDs = explode(',', $rule->product_ids);
|
||||
|
||||
foreach ($matchIDs as $matchID) {
|
||||
foreach ($matchingIDs as $matchingID) {
|
||||
foreach ($eligibleItems as $item) {
|
||||
if (($item->child ? $item->child->product_id : $item->product_id) == $matchID) {
|
||||
if (($item->child ? $item->child->product_id : $item->product_id) == $matchingID) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -104,9 +104,4 @@ abstract class Action
|
|||
|
||||
return $apply();
|
||||
}
|
||||
|
||||
|
||||
private function pushItem($item) {
|
||||
$this->matchedItems->push($item);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,29 +6,25 @@ use Webkul\Discount\Actions\Cart\Action;
|
|||
|
||||
class FixedAmount extends Action
|
||||
{
|
||||
public function calculate($rule)
|
||||
public function __construct($rule)
|
||||
{
|
||||
/**
|
||||
* Setting the rule getting applied
|
||||
*/
|
||||
$this->rule = $rule;
|
||||
}
|
||||
|
||||
public function calculate($rule)
|
||||
{
|
||||
$impact = collect();
|
||||
|
||||
$totalDiscount = 0;
|
||||
|
||||
$applicability = $this->checkApplicability();
|
||||
|
||||
if ($applicability) {
|
||||
if ($rule->action_type == 'whole_cart_to_fixed') {
|
||||
$eligibleItems = \Cart::getCart()->items;
|
||||
}
|
||||
|
||||
$eligibleItems = \Cart::getCart()->items;
|
||||
if ($this->checkApplicability()) {
|
||||
$eligibleItems = $this->getEligibleItems();
|
||||
|
||||
foreach ($eligibleItems as $item) {
|
||||
$report = array();
|
||||
|
||||
$report['item_id'] = $item->id;
|
||||
$report['child_items'] = collect();
|
||||
|
||||
|
|
@ -37,7 +33,6 @@ class FixedAmount extends Action
|
|||
$itemQuantity = $item->quantity;
|
||||
|
||||
$discQuantity = $rule->disc_quantity;
|
||||
|
||||
$discQuantity = $itemQuantity <= $discQuantity ? $itemQuantity : $discQuantity;
|
||||
|
||||
if ($item->product->getTypeInstance()->isComposite()) {
|
||||
|
|
@ -59,7 +54,7 @@ class FixedAmount extends Action
|
|||
foreach ($item->children as $children) {
|
||||
$childBaseTotal = $children->base_total;
|
||||
|
||||
$itemDiscount = $childBaseTotal / (\Cart::getCart()->base_sub_total / 100);
|
||||
$itemDiscount = $childBaseTotal / ($item->base_total / 100);
|
||||
|
||||
$children->discount = ($itemDiscount / 100) * $rule->disc_amount;
|
||||
|
||||
|
|
@ -73,11 +68,9 @@ class FixedAmount extends Action
|
|||
}
|
||||
|
||||
$discount = round($rule->disc_amount, 4) * $discQuantity;
|
||||
|
||||
$discount = $discount <= $itemPrice * $discQuantity ? $discount : $itemPrice * $discQuantity;
|
||||
|
||||
$report['discount'] = $discount;
|
||||
|
||||
$report['formatted_discount'] = core()->currency($discount);
|
||||
|
||||
$impact->push($report);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,14 @@ use Webkul\Discount\Actions\Cart\Action;
|
|||
|
||||
class PercentOfProduct extends Action
|
||||
{
|
||||
public function __construct($rule)
|
||||
{
|
||||
/**
|
||||
* Setting the rule getting applied
|
||||
*/
|
||||
$this->rule = $rule;
|
||||
}
|
||||
|
||||
/**
|
||||
* To calculate impact of cart rule's action of current items of cart instance
|
||||
*
|
||||
|
|
@ -15,11 +23,6 @@ class PercentOfProduct extends Action
|
|||
*/
|
||||
public function calculate($rule)
|
||||
{
|
||||
/**
|
||||
* Setting the rule getting applied
|
||||
*/
|
||||
$this->rule = $rule;
|
||||
|
||||
$impact = collect();
|
||||
|
||||
$totalDiscount = 0;
|
||||
|
|
@ -27,13 +30,7 @@ class PercentOfProduct extends Action
|
|||
$applicability = $this->checkApplicability();
|
||||
|
||||
if ($applicability) {
|
||||
if ($this->rule->action_type == 'whole_cart_to_percent') {
|
||||
$eligibleItems = \Cart::getCart()->items;
|
||||
}
|
||||
|
||||
$cart = \Cart::getCart();
|
||||
|
||||
$eligibleItems = $cart->items;
|
||||
$eligibleItems = $this->getEligibleItems();
|
||||
|
||||
foreach ($eligibleItems as $item) {
|
||||
$report = array();
|
||||
|
|
@ -42,21 +39,14 @@ class PercentOfProduct extends Action
|
|||
$report['child_items'] = collect();
|
||||
|
||||
$itemPrice = $item->base_price;
|
||||
|
||||
$itemQuantity = $item->quantity;
|
||||
|
||||
$discQuantity = $this->rule->disc_quantity;
|
||||
|
||||
$discQuantity = $itemQuantity <= $discQuantity ? $itemQuantity : $discQuantity;
|
||||
|
||||
if ($this->rule->disc_amount > 100) {
|
||||
$discount_amount = 100;
|
||||
} else {
|
||||
$discount_amount = $this->rule->disc_amount;
|
||||
}
|
||||
$discount_amount = ($this->rule->disc_amount > 100) ? 100 : $this->rule->disc_amount;
|
||||
|
||||
$discount = $itemPrice * ($discount_amount / 100) * $discQuantity;
|
||||
|
||||
$discount = $discount <= $itemPrice * $discQuantity ? $discount : $itemPrice * $discQuantity;
|
||||
|
||||
if ($item->product->getTypeInstance()->isComposite()) {
|
||||
|
|
@ -78,9 +68,9 @@ class PercentOfProduct extends Action
|
|||
foreach ($item->children as $children) {
|
||||
$childBaseTotal = $children->base_total;
|
||||
|
||||
$itemDiscount = $childBaseTotal / (\Cart::getCart()->base_sub_total / 100);
|
||||
$itemDiscount = $childBaseTotal / ($item->base_total / 100);
|
||||
|
||||
$children->discount = ($itemDiscount / 100) * ($cart->base_sub_total * ($this->rule->disc_amount / 100));
|
||||
$children->discount = ($itemDiscount / 100) * ($item->base_total * ($this->rule->disc_amount / 100));
|
||||
|
||||
$children->discount = $children->base_total > $children->discount ? $children->discount : $children->base_total;
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,6 @@ class CreateCartRuleTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cart_rule');
|
||||
Schema::dropIfExists('cart_rules');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,6 @@ class CreateCartruleCustomersTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cartrule_customers');
|
||||
Schema::dropIfExists('cart_rule_customers');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,6 @@ class CreateCartruleCouponsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cartrule_coupons');
|
||||
Schema::dropIfExists('cart_rule_coupons');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,6 @@ class CreateCartRuleCartTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cart_rule_order');
|
||||
Schema::dropIfExists('cart_rule_cart');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,6 @@ class CreateCatalogRuleProductsPriceTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('catalog_rule_product_price');
|
||||
Schema::dropIfExists('catalog_rule_products_price');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ abstract class Discount
|
|||
{
|
||||
$this->rules = config('discount-rules');
|
||||
|
||||
$actionType = new $this->rules['cart'][$rule->action_type];
|
||||
$actionType = new $this->rules['cart'][$rule->action_type]($rule);
|
||||
|
||||
return $actionType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,8 +70,16 @@ class CreateProductsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('products');
|
||||
Schema::dropIfExists('product_cross_sells');
|
||||
|
||||
Schema::dropIfExists('product_up_sells');
|
||||
|
||||
Schema::dropIfExists('product_super_attributes');
|
||||
|
||||
Schema::dropIfExists('product_relations');
|
||||
|
||||
Schema::dropIfExists('product_categories');
|
||||
|
||||
Schema::dropIfExists('products');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@ class AddVendorIdColumnInProductInventoriesTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('product_inventories', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,18 +32,13 @@ class AddUpdatedAtColumnInProductFlatTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
|
||||
Schema::table('product_flat', function (Blueprint $table) {
|
||||
$table->dropColumn('created_at');
|
||||
$table->dropColumn('size_label');
|
||||
$table->dropColumn('updated_at');
|
||||
$table->dropColumn('parent_id');
|
||||
$table->dropColumn('visible_individually');
|
||||
$table->dropForeign('parent_id');
|
||||
$table->dropIndex('product_flat_unique_index');
|
||||
});
|
||||
|
||||
Schema::enableForeignKeyConstraints();
|
||||
// Schema::table('product_flat', function (Blueprint $table) {
|
||||
// $table->dropColumn('created_at');
|
||||
// $table->dropColumn('size_label');
|
||||
// $table->dropColumn('updated_at');
|
||||
// $table->dropColumn('parent_id');
|
||||
// $table->dropColumn('visible_individually');
|
||||
// $table->dropIndex('product_flat_unique_index');
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ class AddMinPriceAndMaxPriceColumnInProductFlatTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('product_flat', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('min_price');
|
||||
$table->dropColumn('max_price');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class AlterCustomerIdInProductReviewsTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('product_reviews', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('customer_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,27 @@ class AddRemainingColumnInProductFlatTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('product_flat', function (Blueprint $table) {
|
||||
|
||||
if (Schema::hasColumn('product_flat', 'short_description')) {
|
||||
$table->dropColumn('short_description');
|
||||
}
|
||||
if (Schema::hasColumn('product_flat', 'meta_title')) {
|
||||
$table->dropColumn('meta_title');
|
||||
}
|
||||
if (Schema::hasColumn('product_flat', 'meta_keywords')) {
|
||||
$table->dropColumn('meta_keywords');
|
||||
}
|
||||
if (Schema::hasColumn('product_flat', 'meta_description')) {
|
||||
$table->dropColumn('meta_description');
|
||||
}
|
||||
if (Schema::hasColumn('product_flat', 'width')) {
|
||||
$table->dropColumn('width');
|
||||
}
|
||||
if (Schema::hasColumn('product_flat', 'height')) {
|
||||
$table->dropColumn('height');
|
||||
}
|
||||
if (Schema::hasColumn('product_flat', 'depth')) {
|
||||
$table->dropColumn('depth');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -25,6 +25,8 @@ class AlterOrderTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->dropColumn('cart_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -25,6 +25,8 @@ class AlterInvoiceTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
Schema::table('invoices', function (Blueprint $table) {
|
||||
$table->dropColumn('transaction_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ class AlterShipmentsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
Schema::table('shipments', function (Blueprint $table) {
|
||||
$table->dropForeign('shipments_inventory_source_id_foreign')->references('id')->on('inventory_sources')->onDelete('set null');
|
||||
$table->dropColumn('inventory_source_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@ class AddDiscountColumnsInInvoiceItemsTable extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('invoice_items', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('discount_percent');
|
||||
$table->dropColumn('discount_amount');
|
||||
$table->dropColumn('base_discount_amount');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,6 @@ class CreateTaxMappingsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('tax_map');
|
||||
Schema::dropIfExists('tax_categories_tax_rates');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ class CreateAdminsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::defaultStringLength(191);
|
||||
Schema::create('admins', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
|
|
|
|||
Loading…
Reference in New Issue