Improved code style
This commit is contained in:
parent
0f42e8ff8f
commit
05be7a070a
|
|
@ -78,25 +78,25 @@ class AddressController extends Controller
|
|||
$customer = auth($this->guard)->user();
|
||||
|
||||
request()->merge([
|
||||
'address1' => implode(PHP_EOL, array_filter(request()->input('address1'))),
|
||||
'address1' => implode(PHP_EOL, array_filter(request()->input('address1'))),
|
||||
'customer_id' => $customer->id
|
||||
]);
|
||||
|
||||
$this->validate(request(), [
|
||||
'address1' => 'string|required',
|
||||
'country' => 'string|required',
|
||||
'state' => 'string|required',
|
||||
'city' => 'string|required',
|
||||
'country' => 'string|required',
|
||||
'state' => 'string|required',
|
||||
'city' => 'string|required',
|
||||
'postcode' => 'required',
|
||||
'phone' => 'required'
|
||||
'phone' => 'required'
|
||||
]);
|
||||
|
||||
$customerAddress = $this->customerAddressRepository->create(request()->all());
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Your address has been created successfully.',
|
||||
'data' => new CustomerAddressResource($customerAddress)
|
||||
]);
|
||||
'message' => 'Your address has been created successfully.',
|
||||
'data' => new CustomerAddressResource($customerAddress)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -112,18 +112,18 @@ class AddressController extends Controller
|
|||
|
||||
$this->validate(request(), [
|
||||
'address1' => 'string|required',
|
||||
'country' => 'string|required',
|
||||
'state' => 'string|required',
|
||||
'city' => 'string|required',
|
||||
'country' => 'string|required',
|
||||
'state' => 'string|required',
|
||||
'city' => 'string|required',
|
||||
'postcode' => 'required',
|
||||
'phone' => 'required'
|
||||
'phone' => 'required'
|
||||
]);
|
||||
|
||||
$this->customerAddressRepository->update(request()->all(), request()->input('id'));
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Your address has been updated successfully.',
|
||||
'data' => new CustomerAddressResource($this->customerAddressRepository->find(request()->input('id')))
|
||||
]);
|
||||
'message' => 'Your address has been updated successfully.',
|
||||
'data' => new CustomerAddressResource($this->customerAddressRepository->find(request()->input('id')))
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ class CategoryController extends Controller
|
|||
public function index()
|
||||
{
|
||||
return CategoryResource::collection(
|
||||
$this->categoryRepository->getVisibleCategoryTree(request()->input('parent_id'))
|
||||
);
|
||||
$this->categoryRepository->getVisibleCategoryTree(request()->input('parent_id'))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,9 +192,9 @@ class CheckoutController extends Controller
|
|||
Cart::deActivateCart();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'order' => new OrderResource($order),
|
||||
]);
|
||||
'success' => true,
|
||||
'order' => new OrderResource($order),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class CustomerController extends Controller
|
|||
Event::dispatch('customer.registration.after', $customer);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Your account has been created successfully.'
|
||||
]);
|
||||
'message' => 'Your account has been created successfully.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -30,13 +30,13 @@ class ForgotPasswordController extends Controller
|
|||
|
||||
if ($response == Password::RESET_LINK_SENT) {
|
||||
return response()->json([
|
||||
'message' => trans($response)
|
||||
]);
|
||||
'message' => trans($response)
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'error' => trans($response)
|
||||
]);
|
||||
'error' => trans($response)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ class ProductController extends Controller
|
|||
public function get($id)
|
||||
{
|
||||
return new ProductResource(
|
||||
$this->productRepository->findOrFail($id)
|
||||
);
|
||||
$this->productRepository->findOrFail($id)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -63,8 +63,8 @@ class ProductController extends Controller
|
|||
public function additionalInformation($id)
|
||||
{
|
||||
return response()->json([
|
||||
'data' => app('Webkul\Product\Helpers\View')->getAdditionalData($this->productRepository->findOrFail($id))
|
||||
]);
|
||||
'data' => app('Webkul\Product\Helpers\View')->getAdditionalData($this->productRepository->findOrFail($id))
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -75,7 +75,7 @@ class ProductController extends Controller
|
|||
public function configurableConfig($id)
|
||||
{
|
||||
return response()->json([
|
||||
'data' => app('Webkul\Product\Helpers\ConfigurableOption')->getConfigurationConfig($this->productRepository->findOrFail($id))
|
||||
]);
|
||||
'data' => app('Webkul\Product\Helpers\ConfigurableOption')->getConfigurationConfig($this->productRepository->findOrFail($id))
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ class ResourceController extends Controller
|
|||
public function get($id)
|
||||
{
|
||||
return new $this->_config['resource'](
|
||||
$this->repository->findOrFail($id)
|
||||
);
|
||||
$this->repository->findOrFail($id)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -108,7 +108,7 @@ class ResourceController extends Controller
|
|||
$this->repository->delete($id);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Item removed successfully.'
|
||||
]);
|
||||
'message' => 'Item removed successfully.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ class ReviewController extends Controller
|
|||
$productReview = $this->reviewRepository->create($data);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Your review submitted successfully.',
|
||||
'data' => new ProductReviewResource($this->reviewRepository->find($productReview->id))
|
||||
]);
|
||||
'message' => 'Your review submitted successfully.',
|
||||
'data' => new ProductReviewResource($this->reviewRepository->find($productReview->id))
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -71,10 +71,10 @@ class SessionController extends Controller
|
|||
$customer = auth($this->guard)->user();
|
||||
|
||||
return response()->json([
|
||||
'token' => $jwtToken,
|
||||
'message' => 'Logged in successfully.',
|
||||
'data' => new CustomerResource($customer)
|
||||
]);
|
||||
'token' => $jwtToken,
|
||||
'message' => 'Logged in successfully.',
|
||||
'data' => new CustomerResource($customer)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -124,9 +124,9 @@ class SessionController extends Controller
|
|||
$this->customerRepository->update($data, $customer->id);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Your account has been created successfully.',
|
||||
'data' => new CustomerResource($this->customerRepository->find($customer->id))
|
||||
]);
|
||||
'message' => 'Your account has been created successfully.',
|
||||
'data' => new CustomerResource($this->customerRepository->find($customer->id))
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -64,29 +64,29 @@ class WishlistController extends Controller
|
|||
$customer = auth()->guard($this->guard)->user();
|
||||
|
||||
$wishlistItem = $this->wishlistRepository->findOneWhere([
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $id,
|
||||
'customer_id' => $customer->id
|
||||
]);
|
||||
|
||||
if (! $wishlistItem) {
|
||||
$wishlistItem = $this->wishlistRepository->create([
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $id,
|
||||
'customer_id' => $customer->id
|
||||
]);
|
||||
|
||||
if (! $wishlistItem) {
|
||||
$wishlistItem = $this->wishlistRepository->create([
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $id,
|
||||
'customer_id' => $customer->id
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'data' => new WishlistResource($wishlistItem),
|
||||
'message' => trans('customer::app.wishlist.success')
|
||||
]);
|
||||
'data' => new WishlistResource($wishlistItem),
|
||||
'message' => trans('customer::app.wishlist.success')
|
||||
]);
|
||||
} else {
|
||||
$this->wishlistRepository->delete($wishlistItem->id);
|
||||
|
||||
return response()->json([
|
||||
'data' => null,
|
||||
'message' => 'Item removed from wishlist successfully.'
|
||||
]);
|
||||
'data' => null,
|
||||
'message' => 'Item removed from wishlist successfully.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -102,8 +102,8 @@ class WishlistController extends Controller
|
|||
|
||||
if ($wishlistItem->customer_id != auth()->guard($this->guard)->user()->id) {
|
||||
return response()->json([
|
||||
'message' => trans('shop::app.security-warning')
|
||||
], 400);
|
||||
'message' => trans('shop::app.security-warning')
|
||||
], 400);
|
||||
}
|
||||
|
||||
$result = Cart::moveToCart($wishlistItem);
|
||||
|
|
@ -114,14 +114,14 @@ class WishlistController extends Controller
|
|||
$cart = Cart::getCart();
|
||||
|
||||
return response()->json([
|
||||
'data' => $cart ? new CartResource($cart) : null,
|
||||
'message' => trans('shop::app.wishlist.moved')
|
||||
]);
|
||||
'data' => $cart ? new CartResource($cart) : null,
|
||||
'message' => trans('shop::app.wishlist.moved')
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'data' => -1,
|
||||
'error' => trans('shop::app.wishlist.option-missing')
|
||||
], 400);
|
||||
'data' => -1,
|
||||
'error' => trans('shop::app.wishlist.option-missing')
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -59,8 +59,7 @@ class AddressDataGrid extends DataGrid
|
|||
->on('countries.id', 'country_states.country_id');
|
||||
});
|
||||
|
||||
$queryBuilder
|
||||
->groupBy('ca.id')
|
||||
$queryBuilder->groupBy('ca.id')
|
||||
->addSelect(DB::raw(DB::getTablePrefix() . 'country_states.default_name as state_name'));
|
||||
|
||||
$this->addFilter('address_id', 'ca.id');
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class CMSPageDataGrid extends DataGrid
|
|||
->select('cms_pages.id', 'cms_page_translations.page_title', 'cms_page_translations.url_key')
|
||||
->leftJoin('cms_page_translations', function($leftJoin) {
|
||||
$leftJoin->on('cms_pages.id', '=', 'cms_page_translations.cms_page_id')
|
||||
->where('cms_page_translations.locale', app()->getLocale());
|
||||
->where('cms_page_translations.locale', app()->getLocale());
|
||||
});
|
||||
|
||||
$this->addFilter('id', 'cms_pages.id');
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class CartRuleDataGrid extends DataGrid
|
|||
$queryBuilder = DB::table('cart_rules')
|
||||
->leftJoin('cart_rule_coupons', function($leftJoin) {
|
||||
$leftJoin->on('cart_rule_coupons.cart_rule_id', '=', 'cart_rules.id')
|
||||
->where('cart_rule_coupons.is_primary', 1);
|
||||
->where('cart_rule_coupons.is_primary', 1);
|
||||
})
|
||||
->addSelect('cart_rules.id', 'name', 'cart_rule_coupons.code as coupon_code', 'status', 'starts_from', 'ends_till', 'sort_order');
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class CategoryDataGrid extends DataGrid
|
|||
DB::raw('COUNT(DISTINCT ' . DB::getTablePrefix() . 'pc.product_id) as count'))
|
||||
->leftJoin('category_translations as ct', function($leftJoin) {
|
||||
$leftJoin->on('cat.id', '=', 'ct.category_id')
|
||||
->where('ct.locale', app()->getLocale());
|
||||
->where('ct.locale', app()->getLocale());
|
||||
})
|
||||
->leftJoin('product_categories as pc', 'cat.id', '=', 'pc.category_id')
|
||||
->groupBy('cat.id');
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ class OrderDataGrid extends DataGrid
|
|||
$queryBuilder = DB::table('orders')
|
||||
->leftJoin('order_address as order_address_shipping', function($leftJoin) {
|
||||
$leftJoin->on('order_address_shipping.order_id', '=', 'orders.id')
|
||||
->where('order_address_shipping.address_type', 'shipping');
|
||||
->where('order_address_shipping.address_type', 'shipping');
|
||||
})
|
||||
->leftJoin('order_address as order_address_billing', function($leftJoin) {
|
||||
$leftJoin->on('order_address_billing.order_id', '=', 'orders.id')
|
||||
->where('order_address_billing.address_type', 'billing');
|
||||
->where('order_address_billing.address_type', 'billing');
|
||||
})
|
||||
->addSelect('orders.id','orders.increment_id', 'orders.base_sub_total', 'orders.base_grand_total', 'orders.created_at', 'channel_name', 'status')
|
||||
->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_billing.first_name, " ", ' . DB::getTablePrefix() . 'order_address_billing.last_name) as billed_to'))
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class OrderRefundDataGrid extends DataGrid
|
|||
->leftJoin('orders', 'refunds.order_id', '=', 'orders.id')
|
||||
->leftJoin('order_address as order_address_billing', function($leftJoin) {
|
||||
$leftJoin->on('order_address_billing.order_id', '=', 'orders.id')
|
||||
->where('order_address_billing.address_type', 'billing');
|
||||
->where('order_address_billing.address_type', 'billing');
|
||||
})
|
||||
->addSelect(DB::raw('CONCAT(' . DB::getTablePrefix() . 'order_address_billing.first_name, " ", ' . DB::getTablePrefix() . 'order_address_billing.last_name) as billed_to'));
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class OrderShipmentsDataGrid extends DataGrid
|
|||
$queryBuilder = DB::table('shipments')
|
||||
->leftJoin('order_address as order_address_shipping', function($leftJoin) {
|
||||
$leftJoin->on('order_address_shipping.order_id', '=', 'shipments.order_id')
|
||||
->where('order_address_shipping.address_type', 'shipping');
|
||||
->where('order_address_shipping.address_type', 'shipping');
|
||||
})
|
||||
->leftJoin('orders as ors', 'shipments.order_id', '=', 'ors.id')
|
||||
->leftJoin('inventory_sources as is', 'shipments.inventory_source_id', '=', 'is.id')
|
||||
|
|
|
|||
|
|
@ -67,10 +67,10 @@ class Handler extends ExceptionHandler
|
|||
{
|
||||
if (request()->expectsJson()) {
|
||||
return response()->json([
|
||||
'error' => isset($this->jsonErrorMessages[$statusCode])
|
||||
? $this->jsonErrorMessages[$statusCode]
|
||||
: 'Something went wrong, please try again later.'
|
||||
], $statusCode);
|
||||
'error' => isset($this->jsonErrorMessages[$statusCode])
|
||||
? $this->jsonErrorMessages[$statusCode]
|
||||
: 'Something went wrong, please try again later.'
|
||||
], $statusCode);
|
||||
}
|
||||
|
||||
return response()->view("{$path}::errors.{$statusCode}", [], $statusCode);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class CancelOrderNotification extends Mailable
|
|||
public function build()
|
||||
{
|
||||
return $this->to($this->order->customer_email, $this->order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.order.cancel.subject'))
|
||||
->view('shop::emails.sales.order-cancel');
|
||||
->subject(trans('shop::app.mail.order.cancel.subject'))
|
||||
->view('shop::emails.sales.order-cancel');
|
||||
}
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ class NewAdminNotification extends Mailable
|
|||
public function build()
|
||||
{
|
||||
return $this->to(config('mail.admin.address'))
|
||||
->subject(trans('shop::app.mail.order.subject'))
|
||||
->view('shop::emails.sales.new-admin-order');
|
||||
->subject(trans('shop::app.mail.order.subject'))
|
||||
->view('shop::emails.sales.new-admin-order');
|
||||
}
|
||||
}
|
||||
|
|
@ -51,7 +51,7 @@ class NewCustomerNotification extends Mailable
|
|||
public function build()
|
||||
{
|
||||
return $this->to($this->customer->email)
|
||||
->subject(trans('shop::app.mail.customer.new.subject'))
|
||||
->view('shop::emails.customer.new-customer')->with(['customer' => $this->customer, 'password' => $this->password]);
|
||||
->subject(trans('shop::app.mail.customer.new.subject'))
|
||||
->view('shop::emails.customer.new-customer')->with(['customer' => $this->customer, 'password' => $this->password]);
|
||||
}
|
||||
}
|
||||
|
|
@ -47,7 +47,7 @@ class NewInventorySourceNotification extends Mailable
|
|||
$inventory = $this->shipment->inventory_source;
|
||||
|
||||
return $this->to($inventory->contact_email, $inventory->name)
|
||||
->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-inventorysource-shipment');
|
||||
->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-inventorysource-shipment');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class NewInvoiceNotification extends Mailable
|
|||
$order = $this->invoice->order;
|
||||
|
||||
return $this->to($order->customer_email, $order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.invoice.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-invoice');
|
||||
->subject(trans('shop::app.mail.invoice.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-invoice');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class NewOrderNotification extends Mailable
|
|||
public function build()
|
||||
{
|
||||
return $this->to($this->order->customer_email, $this->order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.order.subject'))
|
||||
->view('shop::emails.sales.new-order');
|
||||
->subject(trans('shop::app.mail.order.subject'))
|
||||
->view('shop::emails.sales.new-order');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class NewRefundNotification extends Mailable
|
|||
$order = $this->refund->order;
|
||||
|
||||
return $this->to($order->customer_email, $order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.refund.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-refund');
|
||||
->subject(trans('shop::app.mail.refund.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-refund');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class NewShipmentNotification extends Mailable
|
|||
$order = $this->shipment->order;
|
||||
|
||||
return $this->to($order->customer_email, $order->customer_full_name)
|
||||
->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-shipment');
|
||||
->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id]))
|
||||
->view('shop::emails.sales.new-shipment');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,23 @@ class Attribute extends TranslatableModel implements AttributeContract
|
|||
{
|
||||
public $translatedAttributes = ['name'];
|
||||
|
||||
protected $fillable = ['code', 'admin_name', 'type', 'position', 'is_required', 'is_unique', 'validation', 'value_per_locale', 'value_per_channel', 'is_filterable', 'is_configurable', 'is_visible_on_front', 'is_user_defined', 'swatch_type', 'use_in_flat'];
|
||||
protected $fillable = [
|
||||
'code',
|
||||
'admin_name',
|
||||
'type',
|
||||
'position',
|
||||
'is_required',
|
||||
'is_unique',
|
||||
'validation',
|
||||
'value_per_locale',
|
||||
'value_per_channel',
|
||||
'is_filterable',
|
||||
'is_configurable',
|
||||
'is_visible_on_front',
|
||||
'is_user_defined',
|
||||
'swatch_type',
|
||||
'use_in_flat',
|
||||
];
|
||||
|
||||
// protected $with = ['options'];
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class AttributeGroup extends Model implements AttributeGroupContract
|
|||
public function custom_attributes()
|
||||
{
|
||||
return $this->belongsToMany(AttributeProxy::modelClass(), 'attribute_group_mappings')
|
||||
->withPivot('position')
|
||||
->orderBy('pivot_position', 'asc');
|
||||
->withPivot('position')
|
||||
->orderBy('pivot_position', 'asc');
|
||||
}
|
||||
}
|
||||
|
|
@ -27,8 +27,9 @@ class AttributeOption extends TranslatableModel implements AttributeOptionContra
|
|||
*/
|
||||
public function swatch_value_url()
|
||||
{
|
||||
if ($this->swatch_value && $this->attribute->swatch_type == 'image')
|
||||
if ($this->swatch_value && $this->attribute->swatch_type == 'image') {
|
||||
return Storage::url($this->swatch_value);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ class AttributeOptionRepository extends Repository
|
|||
|
||||
if ($data['swatch_value'] instanceof \Illuminate\Http\UploadedFile) {
|
||||
parent::update([
|
||||
'swatch_value' => $data['swatch_value']->store('attribute_option')
|
||||
], $optionId);
|
||||
'swatch_value' => $data['swatch_value']->store('attribute_option')
|
||||
], $optionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -68,8 +68,8 @@ class AttributeRepository extends Repository
|
|||
if (in_array($attribute->type, ['select', 'multiselect', 'checkbox']) && count($options)) {
|
||||
foreach ($options as $optionInputs) {
|
||||
$this->attributeOptionRepository->create(array_merge([
|
||||
'attribute_id' => $attribute->id
|
||||
], $optionInputs));
|
||||
'attribute_id' => $attribute->id
|
||||
], $optionInputs));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -101,8 +101,8 @@ class AttributeRepository extends Repository
|
|||
foreach ($data['options'] as $optionId => $optionInputs) {
|
||||
if (Str::contains($optionId, 'option_')) {
|
||||
$this->attributeOptionRepository->create(array_merge([
|
||||
'attribute_id' => $attribute->id,
|
||||
], $optionInputs));
|
||||
'attribute_id' => $attribute->id,
|
||||
], $optionInputs));
|
||||
} else {
|
||||
if (is_numeric($index = $previousOptionIds->search($optionId))) {
|
||||
$previousOptionIds->forget($index);
|
||||
|
|
|
|||
|
|
@ -272,8 +272,8 @@ class Booking
|
|||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
|
||||
$timeDurations = $bookingProductSlot->same_slot_all_days
|
||||
? $bookingProductSlot->slots
|
||||
: ($bookingProductSlot->slots[$requestedDate->format('w')] ?? []);
|
||||
? $bookingProductSlot->slots
|
||||
: ($bookingProductSlot->slots[$requestedDate->format('w')] ?? []);
|
||||
|
||||
$slots = [];
|
||||
|
||||
|
|
@ -315,11 +315,11 @@ class Booking
|
|||
|
||||
if ($qty && $currentTime <= $from) {
|
||||
$slots[] = [
|
||||
'from' => $from->format('h:i A'),
|
||||
'to' => $to->format('h:i A'),
|
||||
'timestamp' => $from->getTimestamp() . '-' . $to->getTimestamp(),
|
||||
'qty' => $qty,
|
||||
];
|
||||
'from' => $from->format('h:i A'),
|
||||
'to' => $to->format('h:i A'),
|
||||
'timestamp' => $from->getTimestamp() . '-' . $to->getTimestamp(),
|
||||
'qty' => $qty,
|
||||
];
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
|
|
@ -371,12 +371,12 @@ class Booking
|
|||
$timestamps = explode('-', $data['additional']['booking']['slot']);
|
||||
|
||||
$result = $this->bookingRepository->getModel()
|
||||
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
|
||||
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
|
||||
->where('bookings.product_id', $data['product_id'])
|
||||
->where('bookings.from', $timestamps[0])
|
||||
->where('bookings.to', $timestamps[1])
|
||||
->first();
|
||||
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
|
||||
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
|
||||
->where('bookings.product_id', $data['product_id'])
|
||||
->where('bookings.from', $timestamps[0])
|
||||
->where('bookings.to', $timestamps[1])
|
||||
->first();
|
||||
|
||||
return ! is_null($result->total_qty_booked) ? $result->total_qty_booked : 0;
|
||||
}
|
||||
|
|
@ -412,7 +412,8 @@ class Booking
|
|||
'attribute_name' => 'Rent Till',
|
||||
'option_id' => 0,
|
||||
'option_label' => Carbon::createFromTimeString($bookingProduct->available_to)->format('d F, Y'),
|
||||
]];
|
||||
]
|
||||
];
|
||||
|
||||
break;
|
||||
|
||||
|
|
@ -442,7 +443,8 @@ class Booking
|
|||
'attribute_name' => 'Rent Till',
|
||||
'option_id' => 0,
|
||||
'option_label' => $to,
|
||||
]];
|
||||
]
|
||||
];
|
||||
|
||||
break;
|
||||
|
||||
|
|
@ -458,7 +460,8 @@ class Booking
|
|||
'attribute_name' => 'Booking Till',
|
||||
'option_id' => 0,
|
||||
'option_label' => Carbon::createFromTimestamp($timestamps[1])->format('d F, Y h:i A'),
|
||||
]];
|
||||
]
|
||||
];
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,12 +37,12 @@ class DefaultSlot extends Booking
|
|||
$currentTime = Carbon::now();
|
||||
|
||||
$availableFrom = ! $bookingProduct->available_from && $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: clone $currentTime;
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: clone $currentTime;
|
||||
|
||||
$availableTo = ! $bookingProduct->available_from && $bookingProduct->available_to
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
|
||||
if ($requestedDate < $currentTime
|
||||
|| $requestedDate < $availableFrom
|
||||
|
|
@ -53,8 +53,8 @@ class DefaultSlot extends Booking
|
|||
$slots = [];
|
||||
|
||||
return $bookingProductSlot->booking_type == 'one'
|
||||
? $this->getOneBookingForManyDaysSlots($bookingProductSlot, $requestedDate)
|
||||
: $this->getManyBookingsforOneDaySlots($bookingProductSlot, $requestedDate);
|
||||
? $this->getOneBookingForManyDaysSlots($bookingProductSlot, $requestedDate)
|
||||
: $this->getManyBookingsforOneDaySlots($bookingProductSlot, $requestedDate);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -101,12 +101,12 @@ class DefaultSlot extends Booking
|
|||
$currentTime = Carbon::now();
|
||||
|
||||
$availableFrom = ! $bookingProduct->available_from && $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: clone $currentTime;
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: clone $currentTime;
|
||||
|
||||
$availableTo = ! $bookingProduct->available_from && $bookingProduct->available_to
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
|
||||
$timeDuration = $bookingProductSlot->slots[$requestedDate->format('w')] ?? [];
|
||||
|
||||
|
|
|
|||
|
|
@ -104,11 +104,11 @@ class EventTicket extends Booking
|
|||
public function getBookedQuantity($data)
|
||||
{
|
||||
$result = $this->bookingRepository->getModel()
|
||||
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
|
||||
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
|
||||
->where('bookings.product_id', $data['product_id'])
|
||||
->where('bookings.booking_product_event_ticket_id', $data['additional']['booking']['ticket_id'])
|
||||
->first();
|
||||
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
|
||||
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
|
||||
->where('bookings.product_id', $data['product_id'])
|
||||
->where('bookings.booking_product_event_ticket_id', $data['additional']['booking']['ticket_id'])
|
||||
->first();
|
||||
|
||||
return ! is_null($result->total_qty_booked) ? $result->total_qty_booked : 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,16 +33,16 @@ class RentalSlot extends Booking
|
|||
$currentTime = Carbon::now();
|
||||
|
||||
$availableFrom = ! $bookingProduct->available_every_week && $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: Carbon::createFromTimeString($currentTime);
|
||||
? Carbon::createFromTimeString($bookingProduct->available_from)
|
||||
: Carbon::createFromTimeString($currentTime);
|
||||
|
||||
$availableTo = ! $bookingProduct->available_every_week && $bookingProduct->available_from
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
? Carbon::createFromTimeString($bookingProduct->available_to)
|
||||
: Carbon::createFromTimeString('2080-01-01 00:00:00');
|
||||
|
||||
$timeDurations = $bookingProductSlot->same_slot_all_days
|
||||
? $bookingProductSlot->slots
|
||||
: $bookingProductSlot->slots[$requestedDate->format('w')];
|
||||
? $bookingProductSlot->slots
|
||||
: $bookingProductSlot->slots[$requestedDate->format('w')];
|
||||
|
||||
$slots = [];
|
||||
|
||||
|
|
@ -148,18 +148,18 @@ class RentalSlot extends Booking
|
|||
}
|
||||
|
||||
$result = $this->bookingRepository->getModel()
|
||||
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
|
||||
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
|
||||
->where('bookings.product_id', $data['product_id'])
|
||||
->where(function ($query) use($from, $to) {
|
||||
$query->where(function ($query) use($from) {
|
||||
$query->where('bookings.from', '<=', $from)->where('bookings.to', '>=', $from);
|
||||
})
|
||||
->orWhere(function($query) use($to) {
|
||||
$query->where('bookings.from', '<=', $to)->where('bookings.to', '>=', $to);
|
||||
});
|
||||
})
|
||||
->first();
|
||||
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
|
||||
->addSelect(DB::raw('SUM(qty_ordered - qty_canceled - qty_refunded) as total_qty_booked'))
|
||||
->where('bookings.product_id', $data['product_id'])
|
||||
->where(function ($query) use($from, $to) {
|
||||
$query->where(function ($query) use($from) {
|
||||
$query->where('bookings.from', '<=', $from)->where('bookings.to', '>=', $from);
|
||||
})
|
||||
->orWhere(function($query) use($to) {
|
||||
$query->where('bookings.from', '<=', $to)->where('bookings.to', '>=', $to);
|
||||
});
|
||||
})
|
||||
->first();
|
||||
|
||||
return ! is_null($result->total_qty_booked) ? $result->total_qty_booked : 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,15 @@ class Booking extends Model implements BookingContract
|
|||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = ['qty', 'from', 'to', 'order_item_id', 'booking_product_event_ticket_id', 'product_id', 'order_id'];
|
||||
protected $fillable = [
|
||||
'qty',
|
||||
'from',
|
||||
'to',
|
||||
'order_item_id',
|
||||
'booking_product_event_ticket_id',
|
||||
'product_id',
|
||||
'order_id',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the order record associated with the order item.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,16 @@ use Webkul\BookingProduct\Contracts\BookingProduct as BookingProductContract;
|
|||
|
||||
class BookingProduct extends Model implements BookingProductContract
|
||||
{
|
||||
protected $fillable = ['location', 'show_location', 'type', 'qty', 'available_every_week', 'available_from', 'available_to', 'product_id'];
|
||||
protected $fillable = [
|
||||
'location',
|
||||
'show_location',
|
||||
'type',
|
||||
'qty',
|
||||
'available_every_week',
|
||||
'available_from',
|
||||
'available_to',
|
||||
'product_id',
|
||||
];
|
||||
|
||||
protected $with = ['default_slot', 'appointment_slot', 'event_tickets', 'rental_slot', 'table_slot'];
|
||||
|
||||
|
|
|
|||
|
|
@ -11,5 +11,15 @@ class BookingProductTableSlot extends Model implements BookingProductTableSlotCo
|
|||
|
||||
protected $casts = ['slots' => 'array'];
|
||||
|
||||
protected $fillable = ['price_type', 'guest_limit', 'guest_capacity', 'duration', 'break_time', 'prevent_scheduling_before', 'same_slot_all_days', 'slots', 'booking_product_id'];
|
||||
protected $fillable = [
|
||||
'price_type',
|
||||
'guest_limit',
|
||||
'guest_capacity',
|
||||
'duration',
|
||||
'break_time',
|
||||
'prevent_scheduling_before',
|
||||
'same_slot_all_days',
|
||||
'slots',
|
||||
'booking_product_id',
|
||||
];
|
||||
}
|
||||
|
|
@ -36,8 +36,8 @@ class BookingProductEventTicketRepository extends Repository
|
|||
foreach ($data['tickets'] as $ticketId => $ticketInputs) {
|
||||
if (Str::contains($ticketId, 'ticket_')) {
|
||||
$this->create(array_merge([
|
||||
'booking_product_id' => $bookingProduct->id,
|
||||
], $ticketInputs));
|
||||
'booking_product_id' => $bookingProduct->id,
|
||||
], $ticketInputs));
|
||||
} else {
|
||||
if (is_numeric($index = $previousTicketIds->search($ticketId))) {
|
||||
$previousTicketIds->forget($index);
|
||||
|
|
|
|||
|
|
@ -61,14 +61,14 @@ class BookingRepository extends Repository
|
|||
}
|
||||
|
||||
$booking = parent::create([
|
||||
'qty' => $item->qty_ordered,
|
||||
'from' => $from,
|
||||
'to' => $to,
|
||||
'order_id' => $order->id,
|
||||
'order_item_id' => $item->id,
|
||||
'product_id' => $item->product_id,
|
||||
'booking_product_event_ticket_id' => $item->additional['booking']['ticket_id'] ?? null,
|
||||
]);
|
||||
'qty' => $item->qty_ordered,
|
||||
'from' => $from,
|
||||
'to' => $to,
|
||||
'order_id' => $order->id,
|
||||
'order_item_id' => $item->id,
|
||||
'product_id' => $item->product_id,
|
||||
'booking_product_event_ticket_id' => $item->additional['booking']['ticket_id'] ?? null,
|
||||
]);
|
||||
|
||||
Event::dispatch('marketplace.booking.save.after', $booking);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,8 +100,8 @@ class Booking extends Virtual
|
|||
$this->bookingProductRepository->update(request('booking'), $bookingProduct->id);
|
||||
} else {
|
||||
$this->bookingProductRepository->create(array_merge(request('booking'), [
|
||||
'product_id' => $id
|
||||
]));
|
||||
'product_id' => $id
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -158,12 +158,12 @@ class Booking extends Virtual
|
|||
}
|
||||
|
||||
$cartProducts = parent::prepareForCart([
|
||||
'product_id' => $data['product_id'],
|
||||
'quantity' => $qty,
|
||||
'booking' => [
|
||||
'ticket_id' => $ticketId,
|
||||
],
|
||||
]);
|
||||
'product_id' => $data['product_id'],
|
||||
'quantity' => $qty,
|
||||
'booking' => [
|
||||
'ticket_id' => $ticketId,
|
||||
],
|
||||
]);
|
||||
|
||||
if (is_string($cartProducts)) {
|
||||
return $cartProducts;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,15 @@ class CmsPage extends TranslatableModel implements CmsPageContract
|
|||
{
|
||||
protected $fillable = ['layout'];
|
||||
|
||||
public $translatedAttributes = ['content', 'meta_description', 'meta_title', 'page_title', 'meta_keywords', 'html_content', 'url_key'];
|
||||
public $translatedAttributes = [
|
||||
'content',
|
||||
'meta_description',
|
||||
'meta_title',
|
||||
'page_title',
|
||||
'meta_keywords',
|
||||
'html_content',
|
||||
'url_key',
|
||||
];
|
||||
|
||||
protected $with = ['translations'];
|
||||
|
||||
|
|
|
|||
|
|
@ -9,5 +9,14 @@ class CmsPageTranslation extends Model implements CmsPageTranslationContract
|
|||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = ['page_title', 'url_key', 'html_content', 'meta_title', 'meta_description', 'meta_keywords', 'locale', 'cms_page_id'];
|
||||
protected $fillable = [
|
||||
'page_title',
|
||||
'url_key',
|
||||
'html_content',
|
||||
'meta_title',
|
||||
'meta_description',
|
||||
'meta_keywords',
|
||||
'locale',
|
||||
'cms_page_id',
|
||||
];
|
||||
}
|
||||
|
|
@ -152,18 +152,18 @@ class CartRule
|
|||
|
||||
$cartRules = $this->cartRuleRepository->scopeQuery(function ($query) use ($customerGroupId) {
|
||||
return $query->leftJoin('cart_rule_customer_groups', 'cart_rules.id', '=', 'cart_rule_customer_groups.cart_rule_id')
|
||||
->leftJoin('cart_rule_channels', 'cart_rules.id', '=', 'cart_rule_channels.cart_rule_id')
|
||||
->where('cart_rule_customer_groups.customer_group_id', $customerGroupId)
|
||||
->where('cart_rule_channels.channel_id', core()->getCurrentChannel()->id)
|
||||
->where(function ($query1) {
|
||||
$query1->where('cart_rules.starts_from', '<=', Carbon::now()->format('Y-m-d'))
|
||||
->orWhereNull('cart_rules.starts_from');
|
||||
})
|
||||
->where(function ($query2) {
|
||||
$query2->where('cart_rules.ends_till', '>=', Carbon::now()->format('Y-m-d'))
|
||||
->orWhereNull('cart_rules.ends_till');
|
||||
})
|
||||
->orderBy('sort_order', 'asc');
|
||||
->leftJoin('cart_rule_channels', 'cart_rules.id', '=', 'cart_rule_channels.cart_rule_id')
|
||||
->where('cart_rule_customer_groups.customer_group_id', $customerGroupId)
|
||||
->where('cart_rule_channels.channel_id', core()->getCurrentChannel()->id)
|
||||
->where(function ($query1) {
|
||||
$query1->where('cart_rules.starts_from', '<=', Carbon::now()->format('Y-m-d'))
|
||||
->orWhereNull('cart_rules.starts_from');
|
||||
})
|
||||
->where(function ($query2) {
|
||||
$query2->where('cart_rules.ends_till', '>=', Carbon::now()->format('Y-m-d'))
|
||||
->orWhereNull('cart_rules.ends_till');
|
||||
})
|
||||
->orderBy('sort_order', 'asc');
|
||||
})->findWhere(['status' => 1]);
|
||||
|
||||
return $cartRules;
|
||||
|
|
|
|||
|
|
@ -98,18 +98,18 @@ class Order
|
|||
}
|
||||
|
||||
$ruleCustomer = $this->cartRuleCustomerRepository->findOneWhere([
|
||||
'customer_id' => $order->customer_id,
|
||||
'cart_rule_id' => $ruleId
|
||||
]);
|
||||
'customer_id' => $order->customer_id,
|
||||
'cart_rule_id' => $ruleId
|
||||
]);
|
||||
|
||||
if ($ruleCustomer) {
|
||||
$this->cartRuleCustomerRepository->update(['times_used' => $ruleCustomer->times_used + 1], $ruleCustomer->id);
|
||||
} else {
|
||||
$this->cartRuleCustomerRepository->create([
|
||||
'customer_id' => $order->customer_id,
|
||||
'cart_rule_id' => $ruleId,
|
||||
'times_used' => 1
|
||||
]);
|
||||
'customer_id' => $order->customer_id,
|
||||
'cart_rule_id' => $ruleId,
|
||||
'times_used' => 1
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -124,18 +124,18 @@ class Order
|
|||
|
||||
if ($order->customer_id) {
|
||||
$couponUsage = $this->cartRuleCouponUsageRepository->findOneWhere([
|
||||
'customer_id' => $order->customer_id,
|
||||
'cart_rule_coupon_id' => $coupon->id
|
||||
]);
|
||||
'customer_id' => $order->customer_id,
|
||||
'cart_rule_coupon_id' => $coupon->id
|
||||
]);
|
||||
|
||||
if ($couponUsage) {
|
||||
$this->cartRuleCouponUsageRepository->update(['times_used' => $couponUsage->times_used + 1], $couponUsage->id);
|
||||
} else {
|
||||
$this->cartRuleCouponUsageRepository->create([
|
||||
'customer_id' => $order->customer_id,
|
||||
'cart_rule_coupon_id' => $coupon->id,
|
||||
'times_used' => 1
|
||||
]);
|
||||
'customer_id' => $order->customer_id,
|
||||
'cart_rule_coupon_id' => $coupon->id,
|
||||
'times_used' => 1
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,16 @@ use Webkul\CartRule\Contracts\CartRuleCoupon as CartRuleCouponContract;
|
|||
|
||||
class CartRuleCoupon extends Model implements CartRuleCouponContract
|
||||
{
|
||||
protected $fillable = ['code', 'usage_limit', 'usage_per_customer', 'times_used', 'type', 'cart_rule_id', 'expired_at', 'is_primary'];
|
||||
protected $fillable = [
|
||||
'code',
|
||||
'usage_limit',
|
||||
'usage_per_customer',
|
||||
'times_used',
|
||||
'type',
|
||||
'cart_rule_id',
|
||||
'expired_at',
|
||||
'is_primary',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the cart rule that owns the cart rule coupon.
|
||||
|
|
|
|||
|
|
@ -44,13 +44,13 @@ class CartRuleCouponRepository extends Repository
|
|||
|
||||
for ($i = 0; $i < $data['coupon_qty']; $i++) {
|
||||
parent::create([
|
||||
'cart_rule_id' => $cartRuleId,
|
||||
'code' => $data['code_prefix'] . $this->getRandomString($data['code_format'], $data['code_length']) . $data['code_suffix'],
|
||||
'usage_limit' => $cartRule->uses_per_coupon ?? 0,
|
||||
'usage_per_customer' => $cartRule->usage_per_customer ?? 0,
|
||||
'is_primary' => 0,
|
||||
'expired_at' => $cartRule->ends_till ?: null
|
||||
]);
|
||||
'cart_rule_id' => $cartRuleId,
|
||||
'code' => $data['code_prefix'] . $this->getRandomString($data['code_format'], $data['code_length']) . $data['code_suffix'],
|
||||
'usage_limit' => $cartRule->uses_per_coupon ?? 0,
|
||||
'usage_per_customer' => $cartRule->usage_per_customer ?? 0,
|
||||
'is_primary' => 0,
|
||||
'expired_at' => $cartRule->ends_till ?: null
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -139,13 +139,13 @@ class CartRuleRepository extends Repository
|
|||
|
||||
if ($data['coupon_type'] && ! $data['use_auto_generation']) {
|
||||
$this->cartRuleCouponRepository->create([
|
||||
'cart_rule_id' => $cartRule->id,
|
||||
'code' => $data['coupon_code'],
|
||||
'usage_limit' => $data['usage_per_customer'] ?? 0,
|
||||
'usage_per_customer' => $data['usage_per_customer'] ?? 0,
|
||||
'is_primary' => 1,
|
||||
'expired_at' => $data['ends_till'] ?: null
|
||||
]);
|
||||
'cart_rule_id' => $cartRule->id,
|
||||
'code' => $data['coupon_code'],
|
||||
'usage_limit' => $data['usage_per_customer'] ?? 0,
|
||||
'usage_per_customer' => $data['usage_per_customer'] ?? 0,
|
||||
'is_primary' => 1,
|
||||
'expired_at' => $data['ends_till'] ?: null
|
||||
]);
|
||||
}
|
||||
|
||||
return $cartRule;
|
||||
|
|
@ -181,29 +181,29 @@ class CartRuleRepository extends Repository
|
|||
|
||||
if ($cartRuleCoupon) {
|
||||
$this->cartRuleCouponRepository->update([
|
||||
'code' => $data['coupon_code'],
|
||||
'usage_limit' => $data['uses_per_coupon'] ?? 0,
|
||||
'usage_per_customer' => $data['usage_per_customer'] ?? 0,
|
||||
'expired_at' => $data['ends_till'] ?: null
|
||||
], $cartRuleCoupon->id);
|
||||
'code' => $data['coupon_code'],
|
||||
'usage_limit' => $data['uses_per_coupon'] ?? 0,
|
||||
'usage_per_customer' => $data['usage_per_customer'] ?? 0,
|
||||
'expired_at' => $data['ends_till'] ?: null
|
||||
], $cartRuleCoupon->id);
|
||||
} else {
|
||||
$this->cartRuleCouponRepository->create([
|
||||
'cart_rule_id' => $cartRule->id,
|
||||
'code' => $data['coupon_code'],
|
||||
'usage_limit' => $data['uses_per_coupon'] ?? 0,
|
||||
'usage_per_customer' => $data['usage_per_customer'] ?? 0,
|
||||
'is_primary' => 1,
|
||||
'expired_at' => $data['ends_till'] ?: null
|
||||
]);
|
||||
'cart_rule_id' => $cartRule->id,
|
||||
'code' => $data['coupon_code'],
|
||||
'usage_limit' => $data['uses_per_coupon'] ?? 0,
|
||||
'usage_per_customer' => $data['usage_per_customer'] ?? 0,
|
||||
'is_primary' => 1,
|
||||
'expired_at' => $data['ends_till'] ?: null
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
$this->cartRuleCouponRepository->deleteWhere(['is_primary' => 1, 'cart_rule_id' => $cartRule->id]);
|
||||
|
||||
$this->cartRuleCouponRepository->getModel()->where('cart_rule_id', $cartRule->id)->update([
|
||||
'usage_limit' => $data['uses_per_coupon'] ?? 0,
|
||||
'usage_per_customer' => $data['usage_per_customer'] ?? 0,
|
||||
'expired_at' => $data['ends_till'] ?: null
|
||||
]);
|
||||
'usage_limit' => $data['uses_per_coupon'] ?? 0,
|
||||
'usage_per_customer' => $data['usage_per_customer'] ?? 0,
|
||||
'expired_at' => $data['ends_till'] ?: null
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
$cartRuleCoupon = $this->cartRuleCouponRepository->deleteWhere(['is_primary' => 1, 'cart_rule_id' => $cartRule->id]);
|
||||
|
|
@ -461,9 +461,9 @@ class CartRuleRepository extends Repository
|
|||
|
||||
foreach ($this->countryRepository->all() as $country) {
|
||||
$countryStates = $this->countryStateRepository->findWhere(
|
||||
['country_id' => $country->id],
|
||||
['code', 'default_name as admin_name']
|
||||
)->toArray();
|
||||
['country_id' => $country->id],
|
||||
['code', 'default_name as admin_name']
|
||||
)->toArray();
|
||||
|
||||
if (! count($countryStates)) {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ class CatalogRuleIndex
|
|||
}
|
||||
|
||||
$productIds = $product->getTypeInstance()->isComposite()
|
||||
? $product->getTypeInstance()->getChildrenIds()
|
||||
: [$product->id];
|
||||
? $product->getTypeInstance()->getChildrenIds()
|
||||
: [$product->id];
|
||||
|
||||
$this->cleanIndexes($productIds);
|
||||
|
||||
|
|
@ -126,10 +126,12 @@ class CatalogRuleIndex
|
|||
|
||||
$catalogRules = $this->catalogRuleRepository->scopeQuery(function($query) {
|
||||
return $query->where(function ($query1) {
|
||||
$query1->where('catalog_rules.starts_from', '<=', Carbon::now()->format('Y-m-d'))->orWhereNull('catalog_rules.starts_from');
|
||||
$query1->where('catalog_rules.starts_from', '<=', Carbon::now()->format('Y-m-d'))
|
||||
->orWhereNull('catalog_rules.starts_from');
|
||||
})
|
||||
->where(function ($query2) {
|
||||
$query2->where('catalog_rules.ends_till', '>=', Carbon::now()->format('Y-m-d'))->orWhereNull('catalog_rules.ends_till');
|
||||
$query2->where('catalog_rules.ends_till', '>=', Carbon::now()->format('Y-m-d'))
|
||||
->orWhereNull('catalog_rules.ends_till');
|
||||
})
|
||||
->orderBy('sort_order', 'asc');
|
||||
})->findWhere(['status' => 1]);
|
||||
|
|
|
|||
|
|
@ -122,10 +122,10 @@ class CatalogRuleProduct
|
|||
{
|
||||
$qb = $this->productRepository->scopeQuery(function($query) use($rule, $product) {
|
||||
$qb = $query->distinct()
|
||||
->addSelect('products.*')
|
||||
->leftJoin('product_flat', 'products.id', '=', 'product_flat.product_id')
|
||||
->leftJoin('channels', 'product_flat.channel', '=', 'channels.code')
|
||||
->whereIn('channels.id', $rule->channels()->pluck('id')->toArray());
|
||||
->addSelect('products.*')
|
||||
->leftJoin('product_flat', 'products.id', '=', 'product_flat.product_id')
|
||||
->leftJoin('channels', 'product_flat.channel', '=', 'channels.code')
|
||||
->whereIn('channels.id', $rule->channels()->pluck('id')->toArray());
|
||||
|
||||
if ($product) {
|
||||
$qb->where('products.id', $product->id);
|
||||
|
|
@ -192,10 +192,10 @@ class CatalogRuleProduct
|
|||
|
||||
$query = $query->leftJoin('product_attribute_values as ' . 'pav_' . $attribute->code, function($qb) use($attribute) {
|
||||
$qb = $qb->where('pav_' . $attribute->code . '.channel', $attribute->value_per_channel ? core()->getDefaultChannelCode() : null)
|
||||
->where('pav_' . $attribute->code . '.locale', $attribute->value_per_locale ? app()->getLocale() : null);
|
||||
->where('pav_' . $attribute->code . '.locale', $attribute->value_per_locale ? app()->getLocale() : null);
|
||||
|
||||
$qb->on('products.id', 'pav_' . $attribute->code . '.product_id')
|
||||
->where('pav_' . $attribute->code . '.attribute_id', $attribute->id);
|
||||
->where('pav_' . $attribute->code . '.attribute_id', $attribute->id);
|
||||
});
|
||||
|
||||
$query = $query->addSelect('pav_' . $attribute->code . '.' . ProductAttributeValue::$attributeTypeFields[$attribute->type] . ' as ' . $attribute->code);
|
||||
|
|
@ -213,13 +213,13 @@ class CatalogRuleProduct
|
|||
{
|
||||
$results = $this->catalogRuleProductRepository->scopeQuery(function($query) use($product) {
|
||||
$qb = $query->distinct()
|
||||
->select('catalog_rule_products.*')
|
||||
->leftJoin('products', 'catalog_rule_products.product_id', '=', 'products.id')
|
||||
->orderBy('channel_id', 'asc')
|
||||
->orderBy('customer_group_id', 'asc')
|
||||
->orderBy('product_id', 'asc')
|
||||
->orderBy('sort_order', 'asc')
|
||||
->orderBy('catalog_rule_id', 'asc');
|
||||
->select('catalog_rule_products.*')
|
||||
->leftJoin('products', 'catalog_rule_products.product_id', '=', 'products.id')
|
||||
->orderBy('channel_id', 'asc')
|
||||
->orderBy('customer_group_id', 'asc')
|
||||
->orderBy('product_id', 'asc')
|
||||
->orderBy('sort_order', 'asc')
|
||||
->orderBy('catalog_rule_id', 'asc');
|
||||
|
||||
$qb = $this->addAttributeToSelect('price', $qb);
|
||||
|
||||
|
|
|
|||
|
|
@ -211,10 +211,10 @@ class CatalogRuleProductPrice
|
|||
}
|
||||
|
||||
return $this->catalogRuleProductPriceRepository->findOneWhere([
|
||||
'product_id' => $product->id,
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'customer_group_id' => $customerGroupId,
|
||||
'rule_date' => Carbon::now()->format('Y-m-d'),
|
||||
]);
|
||||
'product_id' => $product->id,
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'customer_group_id' => $customerGroupId,
|
||||
'rule_date' => Carbon::now()->format('Y-m-d'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,19 @@ use Webkul\Customer\Models\CustomerGroupProxy;
|
|||
|
||||
class CatalogRule extends Model implements CatalogRuleContract
|
||||
{
|
||||
protected $fillable = ['name', 'description', 'starts_from', 'ends_till', 'status', 'condition_type', 'conditions', 'end_other_rules', 'action_type', 'discount_amount', 'sort_order'];
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'description',
|
||||
'starts_from',
|
||||
'ends_till',
|
||||
'status',
|
||||
'condition_type',
|
||||
'conditions',
|
||||
'end_other_rules',
|
||||
'action_type',
|
||||
'discount_amount',
|
||||
'sort_order',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'conditions' => 'array'
|
||||
|
|
|
|||
|
|
@ -9,5 +9,16 @@ class CatalogRuleProduct extends Model implements CatalogRuleProductContract
|
|||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = ['starts_from', 'ends_till', 'discount_amount', 'action_type', 'end_other_rules', 'sort_order', 'catalog_rule_id', 'channel_id', 'customer_group_id', 'product_id'];
|
||||
protected $fillable = [
|
||||
'starts_from',
|
||||
'ends_till',
|
||||
'discount_amount',
|
||||
'action_type',
|
||||
'end_other_rules',
|
||||
'sort_order',
|
||||
'catalog_rule_id',
|
||||
'channel_id',
|
||||
'customer_group_id',
|
||||
'product_id',
|
||||
];
|
||||
}
|
||||
|
|
@ -9,5 +9,13 @@ class CatalogRuleProductPrice extends Model implements CatalogRuleProductPriceCo
|
|||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = ['price', 'rule_date', 'starts_from', 'ends_till', 'catalog_rule_id', 'channel_id', 'customer_group_id'];
|
||||
protected $fillable = [
|
||||
'price',
|
||||
'rule_date',
|
||||
'starts_from',
|
||||
'ends_till',
|
||||
'catalog_rule_id',
|
||||
'channel_id',
|
||||
'customer_group_id',
|
||||
];
|
||||
}
|
||||
|
|
@ -15,11 +15,31 @@ class CategoryTableSeeder extends Seeder
|
|||
$now = Carbon::now();
|
||||
|
||||
DB::table('categories')->insert([
|
||||
['id' => '1','position' => '1','image' => NULL,'status' => '1','_lft' => '1','_rgt' => '14','parent_id' => NULL, 'created_at' => $now, 'updated_at' => $now]
|
||||
[
|
||||
'id' => '1',
|
||||
'position' => '1',
|
||||
'image' => NULL,
|
||||
'status' => '1',
|
||||
'_lft' => '1',
|
||||
'_rgt' => '14',
|
||||
'parent_id' => NULL,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
]
|
||||
]);
|
||||
|
||||
DB::table('category_translations')->insert([
|
||||
['id' => '1','name' => 'Root','slug' => 'root','description' => 'Root','meta_title' => '','meta_description' => '','meta_keywords' => '','category_id' => '1','locale' => 'en']
|
||||
[
|
||||
'id' => '1',
|
||||
'name' => 'Root',
|
||||
'slug' => 'root',
|
||||
'description' => 'Root',
|
||||
'meta_title' => '',
|
||||
'meta_description' => '',
|
||||
'meta_keywords' => '',
|
||||
'category_id' => '1',
|
||||
'locale' => 'en',
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,15 @@ class Category extends TranslatableModel implements CategoryContract
|
|||
{
|
||||
use NodeTrait;
|
||||
|
||||
public $translatedAttributes = ['name', 'description', 'slug', 'url_path', 'meta_title', 'meta_description', 'meta_keywords'];
|
||||
public $translatedAttributes = [
|
||||
'name',
|
||||
'description',
|
||||
'slug',
|
||||
'url_path',
|
||||
'meta_title',
|
||||
'meta_description',
|
||||
'meta_keywords',
|
||||
];
|
||||
|
||||
protected $fillable = ['position', 'status', 'display_mode', 'parent_id'];
|
||||
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ class CategoryRepository extends Repository
|
|||
public function getCategoryTree($id = null)
|
||||
{
|
||||
return $id
|
||||
? $this->model::orderBy('position', 'ASC')->where('id', '!=', $id)->get()->toTree()
|
||||
: $this->model::orderBy('position', 'ASC')->get()->toTree();
|
||||
? $this->model::orderBy('position', 'ASC')->where('id', '!=', $id)->get()->toTree()
|
||||
: $this->model::orderBy('position', 'ASC')->get()->toTree();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -85,8 +85,8 @@ class CategoryRepository extends Repository
|
|||
public function getCategoryTreeWithoutDescendant($id = null)
|
||||
{
|
||||
return $id
|
||||
? $this->model::orderBy('position', 'ASC')->where('id', '!=', $id)->whereNotDescendantOf($id)->get()->toTree()
|
||||
: $this->model::orderBy('position', 'ASC')->get()->toTree();
|
||||
? $this->model::orderBy('position', 'ASC')->where('id', '!=', $id)->whereNotDescendantOf($id)->get()->toTree()
|
||||
: $this->model::orderBy('position', 'ASC')->get()->toTree();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -114,8 +114,8 @@ class CategoryRepository extends Repository
|
|||
}
|
||||
|
||||
return $categories[$id] = $id
|
||||
? $this->model::orderBy('position', 'ASC')->where('status', 1)->descendantsOf($id)->toTree()
|
||||
: $this->model::orderBy('position', 'ASC')->where('status', 1)->get()->toTree();
|
||||
? $this->model::orderBy('position', 'ASC')->where('status', 1)->descendantsOf($id)->toTree()
|
||||
: $this->model::orderBy('position', 'ASC')->where('status', 1)->get()->toTree();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -171,8 +171,8 @@ class Cart
|
|||
} else {
|
||||
if (isset($cartProduct['parent_id']) && $cartItem->parent_id != $parentCartItem->id) {
|
||||
$cartItem = $this->cartItemRepository->create(array_merge($cartProduct, [
|
||||
'cart_id' => $cart->id
|
||||
]));
|
||||
'cart_id' => $cart->id
|
||||
]));
|
||||
} else {
|
||||
if ($cartItem->product->getTypeInstance()->showQuantityBox() === false) {
|
||||
return ['warning' => __('shop::app.checkout.cart.integrity.qty_impossible')];
|
||||
|
|
@ -268,12 +268,12 @@ class Cart
|
|||
Event::dispatch('checkout.cart.update.before', $item);
|
||||
|
||||
$this->cartItemRepository->update([
|
||||
'quantity' => $quantity,
|
||||
'total' => core()->convertPrice($item->price * $quantity),
|
||||
'base_total' => $item->price * $quantity,
|
||||
'total_weight' => $item->weight * $quantity,
|
||||
'base_total_weight' => $item->weight * $quantity,
|
||||
], $itemId);
|
||||
'quantity' => $quantity,
|
||||
'total' => core()->convertPrice($item->price * $quantity),
|
||||
'base_total' => $item->price * $quantity,
|
||||
'total_weight' => $item->weight * $quantity,
|
||||
'base_total_weight' => $item->weight * $quantity,
|
||||
], $itemId);
|
||||
|
||||
Event::dispatch('checkout.cart.update.after', $item);
|
||||
}
|
||||
|
|
@ -556,11 +556,13 @@ class Cart
|
|||
}
|
||||
} else {
|
||||
if (isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
|
||||
$this->cartAddressRepository->create(array_merge($billingAddress,
|
||||
['address_type' => 'shipping']));
|
||||
$this->cartAddressRepository->create(
|
||||
array_merge($billingAddress, ['address_type' => 'shipping'])
|
||||
);
|
||||
} else {
|
||||
$this->cartAddressRepository->create(array_merge($shippingAddress,
|
||||
['address_type' => 'shipping']));
|
||||
$this->cartAddressRepository->create(
|
||||
array_merge($shippingAddress, ['address_type' => 'shipping'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -569,9 +571,13 @@ class Cart
|
|||
|
||||
if ($cart->haveStockableItems()) {
|
||||
if (isset($billingAddress['use_for_shipping']) && $billingAddress['use_for_shipping']) {
|
||||
$this->cartAddressRepository->create(array_merge($billingAddress, ['address_type' => 'shipping']));
|
||||
$this->cartAddressRepository->create(
|
||||
array_merge($billingAddress, ['address_type' => 'shipping'])
|
||||
);
|
||||
} else {
|
||||
$this->cartAddressRepository->create(array_merge($shippingAddress, ['address_type' => 'shipping']));
|
||||
$this->cartAddressRepository->create(
|
||||
array_merge($shippingAddress, ['address_type' => 'shipping'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1037,9 +1043,9 @@ class Cart
|
|||
}
|
||||
|
||||
$wishlistItems = $this->wishlistRepository->findWhere([
|
||||
'customer_id' => $this->getCurrentCustomer()->user()->id,
|
||||
'product_id' => $cartItem->product_id,
|
||||
]);
|
||||
'customer_id' => $this->getCurrentCustomer()->user()->id,
|
||||
'product_id' => $cartItem->product_id,
|
||||
]);
|
||||
|
||||
$found = false;
|
||||
|
||||
|
|
@ -1057,11 +1063,11 @@ class Cart
|
|||
|
||||
if (!$found) {
|
||||
$this->wishlistRepository->create([
|
||||
'channel_id' => $cart->channel_id,
|
||||
'customer_id' => $this->getCurrentCustomer()->user()->id,
|
||||
'product_id' => $cartItem->product_id,
|
||||
'additional' => $cartItem->additional,
|
||||
]);
|
||||
'channel_id' => $cart->channel_id,
|
||||
'customer_id' => $this->getCurrentCustomer()->user()->id,
|
||||
'product_id' => $cartItem->product_id,
|
||||
'additional' => $cartItem->additional,
|
||||
]);
|
||||
}
|
||||
|
||||
$result = $this->cartItemRepository->delete($itemId);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use Webkul\Checkout\Models\CartAddress;
|
|||
|
||||
$factory->define(CartAddress::class, function (Faker $faker) {
|
||||
$now = date("Y-m-d H:i:s");
|
||||
|
||||
return [
|
||||
'first_name' => $faker->firstName(),
|
||||
'last_name' => $faker->lastName,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,17 @@ use Webkul\Checkout\Contracts\CartShippingRate as CartShippingRateContract;
|
|||
|
||||
class CartShippingRate extends Model implements CartShippingRateContract
|
||||
{
|
||||
protected $fillable = ['carrier', 'carrier_title', 'method', 'method_title', 'method_description', 'price', 'base_price', 'discount_amount', 'base_discount_amount'];
|
||||
protected $fillable = [
|
||||
'carrier',
|
||||
'carrier_title',
|
||||
'method',
|
||||
'method_title',
|
||||
'method_description',
|
||||
'price',
|
||||
'base_price',
|
||||
'discount_amount',
|
||||
'base_discount_amount',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the post that owns the comment.
|
||||
|
|
|
|||
|
|
@ -392,8 +392,8 @@ class Core
|
|||
}
|
||||
|
||||
$targetCurrency = ! $targetCurrencyCode
|
||||
? $this->getCurrentCurrency()
|
||||
: $this->currencyRepository->findOneByField('code', $targetCurrencyCode);
|
||||
? $this->getCurrentCurrency()
|
||||
: $this->currencyRepository->findOneByField('code', $targetCurrencyCode);
|
||||
|
||||
if (! $targetCurrency) {
|
||||
return $amount;
|
||||
|
|
@ -427,8 +427,8 @@ class Core
|
|||
public function convertToBasePrice($amount, $targetCurrencyCode = null)
|
||||
{
|
||||
$targetCurrency = ! $targetCurrencyCode
|
||||
? $this->getCurrentCurrency()
|
||||
: $this->currencyRepository->findOneByField('code', $targetCurrencyCode);
|
||||
? $this->getCurrentCurrency()
|
||||
: $this->currencyRepository->findOneByField('code', $targetCurrencyCode);
|
||||
|
||||
if (! $targetCurrency) {
|
||||
return $amount;
|
||||
|
|
@ -821,8 +821,8 @@ class Core
|
|||
|
||||
$start = Carbon::createFromTimeString($date->format('Y-m-d') . ' 00:00:01');
|
||||
$end = $totalMonths - 1 == $i
|
||||
? $endDate
|
||||
: Carbon::createFromTimeString($date->format('Y-m-d') . ' 23:59:59');
|
||||
? $endDate
|
||||
: Carbon::createFromTimeString($date->format('Y-m-d') . ' 23:59:59');
|
||||
|
||||
$timeIntervals[] = ['start' => $start, 'end' => $end, 'formatedDate' => $date->format('M')];
|
||||
}
|
||||
|
|
@ -832,11 +832,11 @@ class Core
|
|||
$date->addWeeks($i);
|
||||
|
||||
$start = $i == 0
|
||||
? $startDate
|
||||
: Carbon::createFromTimeString($this->xWeekRange($date, 0) . ' 00:00:01');
|
||||
? $startDate
|
||||
: Carbon::createFromTimeString($this->xWeekRange($date, 0) . ' 00:00:01');
|
||||
$end = $totalWeeks - 1 == $i
|
||||
? $endDate
|
||||
: Carbon::createFromTimeString($this->xWeekRange($date, 1) . ' 23:59:59');
|
||||
? $endDate
|
||||
: Carbon::createFromTimeString($this->xWeekRange($date, 1) . ' 23:59:59');
|
||||
|
||||
$timeIntervals[] = ['start' => $start, 'end' => $end, 'formatedDate' => $date->format('d M')];
|
||||
}
|
||||
|
|
@ -966,6 +966,7 @@ class Core
|
|||
}
|
||||
|
||||
$finalKey = array_shift($keys);
|
||||
|
||||
if (isset($array[$finalKey])) {
|
||||
$array[$finalKey] = $this->arrayMerge($array[$finalKey], $value);
|
||||
} else {
|
||||
|
|
@ -978,6 +979,7 @@ class Core
|
|||
protected function arrayMerge(array &$array1, array &$array2)
|
||||
{
|
||||
$merged = $array1;
|
||||
|
||||
foreach ($array2 as $key => &$value) {
|
||||
if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
|
||||
$merged[$key] = $this->arrayMerge($merged[$key], $value);
|
||||
|
|
|
|||
|
|
@ -12,31 +12,31 @@ class ChannelTableSeeder extends Seeder
|
|||
DB::table('channels')->delete();
|
||||
|
||||
DB::table('channels')->insert([
|
||||
'id' => 1,
|
||||
'code' => 'default',
|
||||
'name' => 'Default',
|
||||
'root_category_id' => 1,
|
||||
'home_page_content' => '<p>@include("shop::home.slider") @include("shop::home.featured-products") @include("shop::home.new-products")</p><div class="banner-container"><div class="left-banner"><img src="https://s3-ap-southeast-1.amazonaws.com/cdn.uvdesk.com/website/1/201902045c581f9494b8a1.png" /></div><div class="right-banner"><img src="https://s3-ap-southeast-1.amazonaws.com/cdn.uvdesk.com/website/1/201902045c581fb045cf02.png" /> <img src="https://s3-ap-southeast-1.amazonaws.com/cdn.uvdesk.com/website/1/201902045c581fc352d803.png" /></div></div>',
|
||||
'footer_content' => '<div class="list-container"><span class="list-heading">Quick Links</span><ul class="list-group"><li><a href="@php echo route(\'shop.cms.page\', \'about-us\') @endphp">About Us</a></li><li><a href="@php echo route(\'shop.cms.page\', \'return-policy\') @endphp">Return Policy</a></li><li><a href="@php echo route(\'shop.cms.page\', \'refund-policy\') @endphp">Refund Policy</a></li><li><a href="@php echo route(\'shop.cms.page\', \'terms-conditions\') @endphp">Terms and conditions</a></li><li><a href="@php echo route(\'shop.cms.page\', \'terms-of-use\') @endphp">Terms of Use</a></li><li><a href="@php echo route(\'shop.cms.page\', \'contact-us\') @endphp">Contact Us</a></li></ul></div><div class="list-container"><span class="list-heading">Connect With Us</span><ul class="list-group"><li><a href="#"><span class="icon icon-facebook"></span>Facebook </a></li><li><a href="#"><span class="icon icon-twitter"></span> Twitter </a></li><li><a href="#"><span class="icon icon-instagram"></span> Instagram </a></li><li><a href="#"> <span class="icon icon-google-plus"></span>Google+ </a></li><li><a href="#"> <span class="icon icon-linkedin"></span>LinkedIn </a></li></ul></div>',
|
||||
'name' => 'Default',
|
||||
'default_locale_id' => 1,
|
||||
'base_currency_id' => 1,
|
||||
'home_seo' => '{"meta_title": "Demo store", "meta_keywords": "Demo store meta keyword", "meta_description": "Demo store meta description"}'
|
||||
]);
|
||||
'id' => 1,
|
||||
'code' => 'default',
|
||||
'name' => 'Default',
|
||||
'root_category_id' => 1,
|
||||
'home_page_content' => '<p>@include("shop::home.slider") @include("shop::home.featured-products") @include("shop::home.new-products")</p><div class="banner-container"><div class="left-banner"><img src="https://s3-ap-southeast-1.amazonaws.com/cdn.uvdesk.com/website/1/201902045c581f9494b8a1.png" /></div><div class="right-banner"><img src="https://s3-ap-southeast-1.amazonaws.com/cdn.uvdesk.com/website/1/201902045c581fb045cf02.png" /> <img src="https://s3-ap-southeast-1.amazonaws.com/cdn.uvdesk.com/website/1/201902045c581fc352d803.png" /></div></div>',
|
||||
'footer_content' => '<div class="list-container"><span class="list-heading">Quick Links</span><ul class="list-group"><li><a href="@php echo route(\'shop.cms.page\', \'about-us\') @endphp">About Us</a></li><li><a href="@php echo route(\'shop.cms.page\', \'return-policy\') @endphp">Return Policy</a></li><li><a href="@php echo route(\'shop.cms.page\', \'refund-policy\') @endphp">Refund Policy</a></li><li><a href="@php echo route(\'shop.cms.page\', \'terms-conditions\') @endphp">Terms and conditions</a></li><li><a href="@php echo route(\'shop.cms.page\', \'terms-of-use\') @endphp">Terms of Use</a></li><li><a href="@php echo route(\'shop.cms.page\', \'contact-us\') @endphp">Contact Us</a></li></ul></div><div class="list-container"><span class="list-heading">Connect With Us</span><ul class="list-group"><li><a href="#"><span class="icon icon-facebook"></span>Facebook </a></li><li><a href="#"><span class="icon icon-twitter"></span> Twitter </a></li><li><a href="#"><span class="icon icon-instagram"></span> Instagram </a></li><li><a href="#"> <span class="icon icon-google-plus"></span>Google+ </a></li><li><a href="#"> <span class="icon icon-linkedin"></span>LinkedIn </a></li></ul></div>',
|
||||
'name' => 'Default',
|
||||
'default_locale_id' => 1,
|
||||
'base_currency_id' => 1,
|
||||
'home_seo' => '{"meta_title": "Demo store", "meta_keywords": "Demo store meta keyword", "meta_description": "Demo store meta description"}'
|
||||
]);
|
||||
|
||||
DB::table('channel_currencies')->insert([
|
||||
'channel_id' => 1,
|
||||
'currency_id' => 1
|
||||
]);
|
||||
'channel_id' => 1,
|
||||
'currency_id' => 1
|
||||
]);
|
||||
|
||||
DB::table('channel_locales')->insert([
|
||||
'channel_id' => 1,
|
||||
'locale_id' => 1
|
||||
]);
|
||||
'channel_id' => 1,
|
||||
'locale_id' => 1
|
||||
]);
|
||||
|
||||
DB::table('channel_inventory_sources')->insert([
|
||||
'channel_id' => 1,
|
||||
'inventory_source_id' => 1
|
||||
]);
|
||||
'channel_id' => 1,
|
||||
'inventory_source_id' => 1
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -14,14 +14,15 @@ class CurrencyTableSeeder extends Seeder
|
|||
DB::table('currencies')->delete();
|
||||
|
||||
DB::table('currencies')->insert([
|
||||
'id' => 1,
|
||||
'code' => 'USD',
|
||||
'name' => 'US Dollar'
|
||||
], [
|
||||
'id' => 2,
|
||||
'code' => 'EUR',
|
||||
'name' => 'Euro',
|
||||
'symbol' => '€'
|
||||
]);
|
||||
'id' => 1,
|
||||
'code' => 'USD',
|
||||
'name' => 'US Dollar'
|
||||
], [
|
||||
'id' => 2,
|
||||
'code' => 'EUR',
|
||||
'name' => 'Euro',
|
||||
'symbol' => '€'
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class LocalesTableSeeder extends Seeder
|
|||
'id' => 2,
|
||||
'code' => 'fr',
|
||||
'name' => 'French',
|
||||
]);
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -24,6 +24,7 @@ class TranslatableModel extends Model
|
|||
protected function isKeyALocale($key)
|
||||
{
|
||||
$chunks = explode('-', $key);
|
||||
|
||||
if (count($chunks) > 1) {
|
||||
if (Locale::where('code', '=', end($chunks))->first()) {
|
||||
return true;
|
||||
|
|
@ -47,8 +48,7 @@ class TranslatableModel extends Model
|
|||
return $this->defaultLocale;
|
||||
}
|
||||
|
||||
return config('translatable.locale')
|
||||
?: app()->make('translator')->getLocale();
|
||||
return config('translatable.locale') ?: app()->make('translator')->getLocale();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ class Laravel5Helper extends Laravel5
|
|||
'brand' => 'text_value',
|
||||
'guest_checkout' => 'boolean_value',
|
||||
];
|
||||
|
||||
if (! array_key_exists($attribute, $attributes)) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -222,6 +223,7 @@ class Laravel5Helper extends Laravel5
|
|||
private function createAttributeValues(int $productId, array $attributeValues = []): void
|
||||
{
|
||||
$I = $this;
|
||||
|
||||
$productAttributeValues = [
|
||||
'sku',
|
||||
'url_key',
|
||||
|
|
@ -248,7 +250,7 @@ class Laravel5Helper extends Laravel5
|
|||
if (array_key_exists($attribute, $attributeValues)) {
|
||||
$fieldName = self::getAttributeFieldName($attribute);
|
||||
|
||||
if (!array_key_exists($fieldName, $data)) {
|
||||
if (! array_key_exists($fieldName, $data)) {
|
||||
$data[$fieldName] = $attributeValues[$attribute];
|
||||
} else {
|
||||
$data = [$fieldName => $attributeValues[$attribute]];
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class ExchangeRateController extends Controller
|
|||
{
|
||||
$this->validate(request(), [
|
||||
'target_currency' => ['required', 'unique:currency_exchange_rates,target_currency'],
|
||||
'rate' => 'required|numeric'
|
||||
'rate' => 'required|numeric',
|
||||
]);
|
||||
|
||||
Event::dispatch('core.exchange_rate.create.before');
|
||||
|
|
@ -126,7 +126,7 @@ class ExchangeRateController extends Controller
|
|||
{
|
||||
$this->validate(request(), [
|
||||
'target_currency' => ['required', 'unique:currency_exchange_rates,target_currency,' . $id],
|
||||
'rate' => 'required|numeric'
|
||||
'rate' => 'required|numeric',
|
||||
]);
|
||||
|
||||
Event::dispatch('core.exchange_rate.update.before', $id);
|
||||
|
|
@ -155,8 +155,8 @@ class ExchangeRateController extends Controller
|
|||
'success' => false,
|
||||
'rates' => null,
|
||||
'error' => trans('admin::app.exchange-rate.exchange-class-not-found', [
|
||||
'service' => $service
|
||||
])
|
||||
'service' => $service,
|
||||
]),
|
||||
], 400);
|
||||
}
|
||||
|
||||
|
|
@ -165,13 +165,13 @@ class ExchangeRateController extends Controller
|
|||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'rates' => 'rates'
|
||||
'rates' => 'rates',
|
||||
], 200);
|
||||
} else {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'rates' => null,
|
||||
'error' => trans('admin::app.exchange-rate.invalid-config')
|
||||
'error' => trans('admin::app.exchange-rate.invalid-config'),
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class LocaleController extends Controller
|
|||
$this->validate(request(), [
|
||||
'code' => ['required', 'unique:locales,code', new \Webkul\Core\Contracts\Validations\Code],
|
||||
'name' => 'required',
|
||||
'direction' => 'in:ltr,rtl'
|
||||
'direction' => 'in:ltr,rtl',
|
||||
]);
|
||||
|
||||
Event::dispatch('core.locale.create.before');
|
||||
|
|
@ -108,7 +108,7 @@ class LocaleController extends Controller
|
|||
$this->validate(request(), [
|
||||
'code' => ['required', 'unique:locales,code,' . $id, new \Webkul\Core\Contracts\Validations\Code],
|
||||
'name' => 'required',
|
||||
'direction' => 'in:ltr,rtl'
|
||||
'direction' => 'in:ltr,rtl',
|
||||
]);
|
||||
|
||||
Event::dispatch('core.locale.update.before', $id);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class SliderController extends Controller
|
|||
$this->validate(request(), [
|
||||
'title' => 'string|required',
|
||||
'channel_id' => 'required',
|
||||
'image.*' => 'required|mimes:jpeg,bmp,png,jpg'
|
||||
'image.*' => 'required|mimes:jpeg,bmp,png,jpg',
|
||||
]);
|
||||
|
||||
$result = $this->sliderRepository->save(request()->all());
|
||||
|
|
@ -111,11 +111,12 @@ class SliderController extends Controller
|
|||
$this->validate(request(), [
|
||||
'title' => 'string|required',
|
||||
'channel_id' => 'required',
|
||||
'image.*' => 'sometimes|mimes:jpeg,bmp,png,jpg'
|
||||
'image.*' => 'sometimes|mimes:jpeg,bmp,png,jpg',
|
||||
]);
|
||||
|
||||
if ( is_null(request()->image)) {
|
||||
session()->flash('error', trans('admin::app.settings.sliders.update-fail'));
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,10 +78,11 @@ class SubscriptionController extends Controller
|
|||
|
||||
$result = $subscriber->update($data);
|
||||
|
||||
if ($result)
|
||||
if ($result) {
|
||||
session()->flash('success', trans('admin::app.customers.subscribers.update-success'));
|
||||
else
|
||||
} else {
|
||||
session()->flash('error', trans('admin::app.customers.subscribers.update-failed'));
|
||||
}
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
|
@ -104,6 +105,7 @@ class SubscriptionController extends Controller
|
|||
return response()->json(['message' => true], 200);
|
||||
} catch (\Exception $e) {
|
||||
report($e);
|
||||
|
||||
session()->flash('error', trans('admin::app.response.delete-failed', ['name' => 'Subscriber']));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,19 @@ use Webkul\Core\Contracts\Channel as ChannelContract;
|
|||
|
||||
class Channel extends Model implements ChannelContract
|
||||
{
|
||||
protected $fillable = ['code', 'name', 'description', 'theme', 'home_page_content', 'footer_content', 'hostname', 'default_locale_id', 'base_currency_id', 'root_category_id', 'home_seo'];
|
||||
protected $fillable = [
|
||||
'code',
|
||||
'name',
|
||||
'description',
|
||||
'theme',
|
||||
'home_page_content',
|
||||
'footer_content',
|
||||
'hostname',
|
||||
'default_locale_id',
|
||||
'base_currency_id',
|
||||
'root_category_id',
|
||||
'home_seo',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the channel locales.
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ class CoreConfig extends Model implements CoreConfigContract
|
|||
protected $table = 'core_config';
|
||||
|
||||
protected $fillable = [
|
||||
'code', 'value','channel_code','locale_code'
|
||||
'code',
|
||||
'value',
|
||||
'channel_code',
|
||||
'locale_code',
|
||||
];
|
||||
|
||||
protected $hidden = ['token'];
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class CurrencyExchangeRate extends Model implements CurrencyExchangeRateContract
|
|||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'target_currency', 'rate'
|
||||
'target_currency',
|
||||
'rate',
|
||||
];
|
||||
}
|
||||
|
|
@ -13,6 +13,8 @@ class Locale extends Model implements LocaleContract
|
|||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'code', 'name', 'direction'
|
||||
'code',
|
||||
'name',
|
||||
'direction',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ class Slider extends Model implements SliderContract
|
|||
protected $table = 'sliders';
|
||||
|
||||
protected $fillable = [
|
||||
'title', 'path', 'content', 'channel_id'
|
||||
'title',
|
||||
'path',
|
||||
'content',
|
||||
'channel_id',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ class SubscribersList extends Model implements SubscribersListContract
|
|||
protected $table = 'subscribers_list';
|
||||
|
||||
protected $fillable = [
|
||||
'email', 'is_subscribed', 'token', 'channel_id'
|
||||
'email',
|
||||
'is_subscribed',
|
||||
'token',
|
||||
'channel_id',
|
||||
];
|
||||
|
||||
protected $hidden = ['token'];
|
||||
|
|
|
|||
|
|
@ -85,11 +85,11 @@ class CoreConfigRepository extends Repository
|
|||
|
||||
if (! count($coreConfigValue)) {
|
||||
$this->model->create([
|
||||
'code' => $fieldName,
|
||||
'value' => $value,
|
||||
'locale_code' => $localeBased ? $locale : null,
|
||||
'channel_code' => $channelBased ? $channel : null
|
||||
]);
|
||||
'code' => $fieldName,
|
||||
'value' => $value,
|
||||
'locale_code' => $localeBased ? $locale : null,
|
||||
'channel_code' => $channelBased ? $channel : null
|
||||
]);
|
||||
} else {
|
||||
foreach ($coreConfigValue as $coreConfig) {
|
||||
Storage::delete($coreConfig['value']);
|
||||
|
|
@ -98,11 +98,11 @@ class CoreConfigRepository extends Repository
|
|||
$this->model->destroy($coreConfig['id']);
|
||||
} else {
|
||||
$coreConfig->update([
|
||||
'code' => $fieldName,
|
||||
'value' => $value,
|
||||
'locale_code' => $localeBased ? $locale : null,
|
||||
'channel_code' => $channelBased ? $channel : null
|
||||
]);
|
||||
'code' => $fieldName,
|
||||
'value' => $value,
|
||||
'locale_code' => $localeBased ? $locale : null,
|
||||
'channel_code' => $channelBased ? $channel : null
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -117,6 +117,7 @@ class CoreConfigRepository extends Repository
|
|||
*/
|
||||
public function recuressiveArray(array $formData, $method) {
|
||||
static $data = [];
|
||||
|
||||
static $recuressiveArrayData = [];
|
||||
|
||||
foreach ($formData as $form => $formValue) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ class CurrencyRepository extends Repository
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -190,6 +190,7 @@ class RegistrationController extends Controller
|
|||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
session()->flash('success', trans('shop::app.customer.signup-form.verification-sent'));
|
||||
|
||||
return redirect()->back();
|
||||
|
|
|
|||
|
|
@ -88,10 +88,10 @@ class WishlistController extends Controller
|
|||
];
|
||||
|
||||
$checked = $this->wishlistRepository->findWhere([
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $itemId,
|
||||
'customer_id' => auth()->guard('customer')->user()->id
|
||||
]);
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $itemId,
|
||||
'customer_id' => auth()->guard('customer')->user()->id
|
||||
]);
|
||||
|
||||
//accidental case if some one adds id of the product in the anchor tag amd gives id of a variant.
|
||||
if ($product->parent_id != null) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class RedirectIfNotCustomer
|
|||
Auth::guard($guard)->logout();
|
||||
|
||||
session()->flash('warning', trans('shop::app.customer.login-form.not-activated'));
|
||||
|
||||
return redirect()->route('customer.session.index');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class RegistrationEmail extends Mailable
|
|||
public function build()
|
||||
{
|
||||
return $this->to($this->data['email'])
|
||||
->subject(trans('shop::app.mail.customer.registration.customer-registration'))
|
||||
->view('shop::emails.customer.registration')->with('data', $this->data);
|
||||
->subject(trans('shop::app.mail.customer.registration.customer-registration'))
|
||||
->view('shop::emails.customer.registration')->with('data', $this->data);
|
||||
}
|
||||
}
|
||||
|
|
@ -31,7 +31,12 @@ class VerificationEmail extends Mailable
|
|||
public function build()
|
||||
{
|
||||
return $this->to($this->verificationData['email'])
|
||||
->subject(trans('shop::app.mail.customer.verification.subject'))
|
||||
->view('shop::emails.customer.verification-email')->with('data', ['email' => $this->verificationData['email'], 'token' => $this->verificationData['token']]);
|
||||
->subject(trans('shop::app.mail.customer.verification.subject'))
|
||||
->view('shop::emails.customer.verification-email')
|
||||
->with('data', [
|
||||
'email' => $this->verificationData['email'],
|
||||
'token' => $this->verificationData['token'],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,21 +17,38 @@ class Customer extends Authenticatable implements CustomerContract, JWTSubject
|
|||
|
||||
protected $table = 'customers';
|
||||
|
||||
protected $fillable = ['first_name', 'last_name', 'gender', 'date_of_birth', 'email', 'phone', 'password', 'api_token', 'customer_group_id', 'subscribed_to_news_letter', 'is_verified', 'token', 'notes', 'status'];
|
||||
protected $fillable = [
|
||||
'first_name',
|
||||
'last_name',
|
||||
'gender',
|
||||
'date_of_birth',
|
||||
'email',
|
||||
'phone',
|
||||
'password',
|
||||
'api_token',
|
||||
'customer_group_id',
|
||||
'subscribed_to_news_letter',
|
||||
'is_verified',
|
||||
'token',
|
||||
'notes',
|
||||
'status',
|
||||
];
|
||||
|
||||
protected $hidden = ['password', 'api_token', 'remember_token'];
|
||||
|
||||
/**
|
||||
* Get the customer full name.
|
||||
*/
|
||||
public function getNameAttribute() {
|
||||
public function getNameAttribute()
|
||||
{
|
||||
return ucfirst($this->first_name) . ' ' . ucfirst($this->last_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Email exists or not
|
||||
*/
|
||||
public function emailExists($email) {
|
||||
public function emailExists($email)
|
||||
{
|
||||
$results = $this->where('email', $email);
|
||||
|
||||
if ($results->count() == 0) {
|
||||
|
|
@ -79,42 +96,48 @@ class Customer extends Authenticatable implements CustomerContract, JWTSubject
|
|||
/**
|
||||
* Customer's relation with wishlist items
|
||||
*/
|
||||
public function wishlist_items() {
|
||||
public function wishlist_items()
|
||||
{
|
||||
return $this->hasMany(WishlistProxy::modelClass(), 'customer_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* get all cart inactive cart instance of a customer
|
||||
*/
|
||||
public function all_carts() {
|
||||
public function all_carts()
|
||||
{
|
||||
return $this->hasMany(CartProxy::modelClass(), 'customer_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* get inactive cart inactive cart instance of a customer
|
||||
*/
|
||||
public function inactive_carts() {
|
||||
public function inactive_carts()
|
||||
{
|
||||
return $this->hasMany(CartProxy::modelClass(), 'customer_id')->where('is_active', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* get active cart inactive cart instance of a customer
|
||||
*/
|
||||
public function active_carts() {
|
||||
public function active_carts()
|
||||
{
|
||||
return $this->hasMany(CartProxy::modelClass(), 'customer_id')->where('is_active', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* get all reviews of a customer
|
||||
*/
|
||||
public function all_reviews() {
|
||||
public function all_reviews()
|
||||
{
|
||||
return $this->hasMany(ProductReviewProxy::modelClass(), 'customer_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* get all orders of a customer
|
||||
*/
|
||||
public function all_orders() {
|
||||
public function all_orders()
|
||||
{
|
||||
return $this->hasMany(OrderProxy::modelClass(), 'customer_id');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,15 @@ class Wishlist extends Model implements WishlistContract
|
|||
'additional' => 'array',
|
||||
];
|
||||
|
||||
protected $fillable = ['channel_id', 'product_id', 'customer_id', 'additional', 'moved_to_cart', 'shared', 'time_of_moving'];
|
||||
protected $fillable = [
|
||||
'channel_id',
|
||||
'product_id',
|
||||
'customer_id',
|
||||
'additional',
|
||||
'moved_to_cart',
|
||||
'shared',
|
||||
'time_of_moving'
|
||||
];
|
||||
|
||||
/**
|
||||
* The Product that belong to the wishlist.
|
||||
|
|
|
|||
|
|
@ -23,8 +23,9 @@ class CustomerResetPassword extends ResetPassword
|
|||
return (new MailMessage)
|
||||
->subject(__('shop::app.mail.forget-password.subject') )
|
||||
->view('shop::emails.customer.forget-password', [
|
||||
'user_name' => $notifiable->name,
|
||||
'token' => $this->token
|
||||
]);
|
||||
'user_name' => $notifiable->name,
|
||||
'token' => $this->token
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@ class InventorySourceController extends Controller
|
|||
return response()->json(['message' => true], 200);
|
||||
} catch (\Exception $e) {
|
||||
report($e);
|
||||
|
||||
session()->flash('error', trans('admin::app.response.delete-failed', ['name' => 'Inventory source']));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ class Payment
|
|||
$paymentMethods = $this->getPaymentMethods();
|
||||
|
||||
return [
|
||||
'jump_to_section' => 'payment',
|
||||
'paymentMethods' => $this->getPaymentMethods(),
|
||||
'html' => view('shop::checkout.onepage.payment', compact('paymentMethods'))->render()
|
||||
];
|
||||
'jump_to_section' => 'payment',
|
||||
'paymentMethods' => $this->getPaymentMethods(),
|
||||
'html' => view('shop::checkout.onepage.payment', compact('paymentMethods'))->render()
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ abstract class Paypal extends Payment
|
|||
public function getPaypalUrl($params = [])
|
||||
{
|
||||
return sprintf('https://www.%spaypal.com/cgi-bin/webscr%s',
|
||||
$this->getConfigData('sandbox') ? 'sandbox.' : '',
|
||||
$params ? '?' . http_build_query($params) : ''
|
||||
);
|
||||
$this->getConfigData('sandbox') ? 'sandbox.' : '',
|
||||
$params ? '?' . http_build_query($params) : ''
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -70,13 +70,13 @@ class PriceUpdate extends Command
|
|||
$product->parent->save();
|
||||
} else {
|
||||
$bundleProducts = $this->productFlatRepository->getModel()
|
||||
->addSelect('product_flat.*')
|
||||
->distinct()
|
||||
->leftJoin('products', 'product_flat.product_id', 'products.id')
|
||||
->leftJoin('product_bundle_options', 'products.id', 'product_bundle_options.product_id')
|
||||
->leftJoin('product_bundle_option_products', 'product_bundle_options.id', 'product_bundle_option_products.product_bundle_option_id')
|
||||
->where('product_bundle_option_products.product_id', $product->product_id)
|
||||
->get();
|
||||
->addSelect('product_flat.*')
|
||||
->distinct()
|
||||
->leftJoin('products', 'product_flat.product_id', 'products.id')
|
||||
->leftJoin('product_bundle_options', 'products.id', 'product_bundle_options.product_id')
|
||||
->leftJoin('product_bundle_option_products', 'product_bundle_options.id', 'product_bundle_option_productsproduct_bundle_option_id')
|
||||
->where('product_bundle_option_products.product_id', $product->product_id)
|
||||
->get();
|
||||
|
||||
foreach ($bundleProducts as $bundleProduct) {
|
||||
$bundleProduct->min_price = $bundleProduct->getTypeInstance()->getMinimalPrice();
|
||||
|
|
|
|||
|
|
@ -88,10 +88,10 @@ class Review extends AbstractProduct
|
|||
public function getPercentageRating($product)
|
||||
{
|
||||
$reviews = $product->reviews()->where('status', 'approved')
|
||||
->select('rating', DB::raw('count(*) as total'))
|
||||
->groupBy('rating')
|
||||
->orderBy('rating','desc')
|
||||
->get();
|
||||
->select('rating', DB::raw('count(*) as total'))
|
||||
->groupBy('rating')
|
||||
->orderBy('rating','desc')
|
||||
->get();
|
||||
|
||||
$totalReviews = $this->getTotalReviews($product);
|
||||
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ class Toolbar extends AbstractProduct
|
|||
$keys = explode('-', $key);
|
||||
|
||||
return request()->fullUrlWithQuery([
|
||||
'sort' => current($keys),
|
||||
'order' => end($keys)
|
||||
]);
|
||||
'sort' => current($keys),
|
||||
'order' => end($keys)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -63,8 +63,8 @@ class Toolbar extends AbstractProduct
|
|||
public function getLimitUrl($limit)
|
||||
{
|
||||
return request()->fullUrlWithQuery([
|
||||
'limit' => $limit
|
||||
]);
|
||||
'limit' => $limit
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -76,8 +76,8 @@ class Toolbar extends AbstractProduct
|
|||
public function getModeUrl($mode)
|
||||
{
|
||||
return request()->fullUrlWithQuery([
|
||||
'mode' => $mode
|
||||
]);
|
||||
'mode' => $mode
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -246,6 +246,7 @@ class ProductController extends Controller
|
|||
return response()->json(['message' => true], 200);
|
||||
} catch (\Exception $e) {
|
||||
report($e);
|
||||
|
||||
session()->flash('error', trans('admin::app.response.delete-failed', ['name' => 'Product']));
|
||||
}
|
||||
|
||||
|
|
@ -328,10 +329,10 @@ class ProductController extends Controller
|
|||
|
||||
foreach ($this->productRepository->searchProductByAttribute(request()->input('query')) as $row) {
|
||||
$results[] = [
|
||||
'id' => $row->product_id,
|
||||
'sku' => $row->sku,
|
||||
'name' => $row->name,
|
||||
];
|
||||
'id' => $row->product_id,
|
||||
'sku' => $row->sku,
|
||||
'name' => $row->name,
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($results);
|
||||
|
|
|
|||
|
|
@ -140,10 +140,11 @@ class ReviewController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
if (! $suppressFlash)
|
||||
if (! $suppressFlash) {
|
||||
session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success', ['resource' => 'Reviews']));
|
||||
else
|
||||
} else {
|
||||
session()->flash('info', trans('admin::app.datagrid.mass-ops.partial-action', ['resource' => 'Reviews']));
|
||||
}
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
|
||||
|
|
@ -194,10 +195,11 @@ class ReviewController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
if (! $suppressFlash)
|
||||
if (! $suppressFlash) {
|
||||
session()->flash('success', trans('admin::app.datagrid.mass-ops.update-success', ['resource' => 'Reviews']));
|
||||
else
|
||||
} else {
|
||||
session()->flash('info', trans('admin::app.datagrid.mass-ops.partial-action', ['resource' => 'Reviews']));
|
||||
}
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -93,10 +93,10 @@ class ProductForm extends FormRequest
|
|||
|
||||
if ($attribute->type == 'text' && $attribute->validation) {
|
||||
array_push($validations,
|
||||
$attribute->validation == 'decimal'
|
||||
? new \Webkul\Core\Contracts\Validations\Decimal
|
||||
: $attribute->validation
|
||||
);
|
||||
$attribute->validation == 'decimal'
|
||||
? new \Webkul\Core\Contracts\Validations\Decimal
|
||||
: $attribute->validation
|
||||
);
|
||||
}
|
||||
|
||||
if ($attribute->type == 'price') {
|
||||
|
|
|
|||
|
|
@ -223,9 +223,16 @@ class ProductFlat
|
|||
|
||||
if ($attribute->value_per_channel) {
|
||||
if ($attribute->value_per_locale) {
|
||||
$productAttributeValue = $product->attribute_values()->where('channel', $channel->code)->where('locale', $locale->code)->where('attribute_id', $attribute->id)->first();
|
||||
$productAttributeValue = $product->attribute_values()
|
||||
->where('channel', $channel->code)
|
||||
->where('locale', $locale->code)
|
||||
->where('attribute_id', $attribute->id)
|
||||
->first();
|
||||
} else {
|
||||
$productAttributeValue = $product->attribute_values()->where('channel', $channel->code)->where('attribute_id', $attribute->id)->first();
|
||||
$productAttributeValue = $product->attribute_values()
|
||||
->where('channel', $channel->code)
|
||||
->where('attribute_id', $attribute->id)
|
||||
->first();
|
||||
}
|
||||
} else {
|
||||
if ($attribute->value_per_locale) {
|
||||
|
|
|
|||
|
|
@ -181,8 +181,8 @@ class Product extends Model implements ProductContract
|
|||
public function inventory_source_qty($inventorySourceId)
|
||||
{
|
||||
return $this->inventories()
|
||||
->where('inventory_source_id', $inventorySourceId)
|
||||
->sum('qty');
|
||||
->where('inventory_source_id', $inventorySourceId)
|
||||
->sum('qty');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -264,7 +264,7 @@ class Product extends Model implements ProductContract
|
|||
$this->attributes[$key] = '';
|
||||
|
||||
$attribute = core()->getSingletonInstance(\Webkul\Attribute\Repositories\AttributeRepository::class)
|
||||
->getAttributeByCode($key);
|
||||
->getAttributeByCode($key);
|
||||
|
||||
$this->attributes[$key] = $this->getCustomAttributeValue($attribute);
|
||||
|
||||
|
|
@ -286,7 +286,7 @@ class Product extends Model implements ProductContract
|
|||
|
||||
if (isset($this->id)) {
|
||||
$familyAttributes = core()->getSingletonInstance(\Webkul\Attribute\Repositories\AttributeRepository::class)
|
||||
->getFamilyAttributes($this->attribute_family);
|
||||
->getFamilyAttributes($this->attribute_family);
|
||||
|
||||
foreach ($familyAttributes as $attribute) {
|
||||
if (in_array($attribute->code, $hiddenAttributes)) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,14 @@ class ProductBundleOptionProduct extends Model implements ProductBundleOptionPro
|
|||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = ['qty', 'is_user_defined', 'sort_order', 'is_default', 'product_bundle_option_id', 'product_id'];
|
||||
protected $fillable = [
|
||||
'qty',
|
||||
'is_user_defined',
|
||||
'sort_order',
|
||||
'is_default',
|
||||
'product_bundle_option_id',
|
||||
'product_id',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the bundle option that owns this resource.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,21 @@ class ProductDownloadableLink extends TranslatableModel implements ProductDownlo
|
|||
{
|
||||
public $translatedAttributes = ['title'];
|
||||
|
||||
protected $fillable = ['title', 'price', 'url', 'file', 'file_name', 'type', 'sample_url', 'sample_file', 'sample_file_name', 'sample_type', 'sort_order', 'product_id', 'downloads'];
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'price',
|
||||
'url',
|
||||
'file',
|
||||
'file_name',
|
||||
'type',
|
||||
'sample_url',
|
||||
'sample_file',
|
||||
'sample_file_name',
|
||||
'sample_type',
|
||||
'sort_order',
|
||||
'product_id',
|
||||
'downloads',
|
||||
];
|
||||
|
||||
protected $with = ['translations'];
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,15 @@ use Webkul\Product\Contracts\ProductReview as ProductReviewContract;
|
|||
|
||||
class ProductReview extends Model implements ProductReviewContract
|
||||
{
|
||||
protected $fillable = ['comment', 'title', 'rating', 'status', 'product_id', 'customer_id', 'name'];
|
||||
protected $fillable = [
|
||||
'comment',
|
||||
'title',
|
||||
'rating',
|
||||
'status',
|
||||
'product_id',
|
||||
'customer_id',
|
||||
'name',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the product attribute family that owns the product.
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue