Optimized and refactored code
This commit is contained in:
parent
b41368a410
commit
809a215730
|
|
@ -0,0 +1,13 @@
|
||||||
|
db-blade-compiler.php
|
||||||
|
debugbar.php
|
||||||
|
dompdf.php
|
||||||
|
excel.php
|
||||||
|
flare.php
|
||||||
|
ignition.php
|
||||||
|
image.php
|
||||||
|
imagecache.php
|
||||||
|
jwt.php
|
||||||
|
repository.php
|
||||||
|
scout.php
|
||||||
|
tinker.php
|
||||||
|
translatable.php
|
||||||
|
|
@ -79,6 +79,7 @@ class ConfigurationController extends Controller
|
||||||
{
|
{
|
||||||
if (! request()->route('slug')) {
|
if (! request()->route('slug')) {
|
||||||
$firstItem = current($this->configTree->items);
|
$firstItem = current($this->configTree->items);
|
||||||
|
|
||||||
$secondItem = current($firstItem['children']);
|
$secondItem = current($firstItem['children']);
|
||||||
|
|
||||||
return $this->getSlugs($secondItem);
|
return $this->getSlugs($secondItem);
|
||||||
|
|
@ -109,6 +110,7 @@ class ConfigurationController extends Controller
|
||||||
foreach ($data['sales']['carriers'] as $carrier) {
|
foreach ($data['sales']['carriers'] as $carrier) {
|
||||||
if ($carrier['active']) {
|
if ($carrier['active']) {
|
||||||
$atLeastOneCarrierEnabled = true;
|
$atLeastOneCarrierEnabled = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,6 @@ class AddressController extends Controller
|
||||||
'address1' => implode(PHP_EOL, array_filter(request()->input('address1'))),
|
'address1' => implode(PHP_EOL, array_filter(request()->input('address1'))),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$data = collect(request()->input())->except('_token')->toArray();
|
|
||||||
|
|
||||||
$this->validate(request(), [
|
$this->validate(request(), [
|
||||||
'company_name' => 'string',
|
'company_name' => 'string',
|
||||||
'address1' => 'string|required',
|
'address1' => 'string|required',
|
||||||
|
|
@ -86,10 +84,10 @@ class AddressController extends Controller
|
||||||
'vat_id' => new VatIdRule(),
|
'vat_id' => new VatIdRule(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($this->customerAddressRepository->create($data)) {
|
if ($this->customerAddressRepository->create(request()->all())) {
|
||||||
session()->flash('success', trans('admin::app.customers.addresses.success-create'));
|
session()->flash('success', trans('admin::app.customers.addresses.success-create'));
|
||||||
|
|
||||||
return redirect()->route('admin.customer.edit', ['id' => $data['customer_id']]);
|
return redirect()->route('admin.customer.edit', ['id' => request('customer_id')]);
|
||||||
} else {
|
} else {
|
||||||
session()->flash('success', trans('admin::app.customers.addresses.error-create'));
|
session()->flash('success', trans('admin::app.customers.addresses.error-create'));
|
||||||
|
|
||||||
|
|
@ -131,18 +129,11 @@ class AddressController extends Controller
|
||||||
'vat_id' => new VatIdRule(),
|
'vat_id' => new VatIdRule(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$data = collect(request()->input())->except('_token')->toArray();
|
$this->customerAddressRepository->update(request()->all(), $id);
|
||||||
|
|
||||||
$address = $this->customerAddressRepository->find($id);
|
session()->flash('success', trans('admin::app.customers.addresses.success-update'));
|
||||||
|
|
||||||
if ($address) {
|
return redirect()->route('admin.customer.addresses.index', ['id' => $address->customer_id]);
|
||||||
$this->customerAddressRepository->update($data, $id);
|
|
||||||
|
|
||||||
session()->flash('success', trans('admin::app.customers.addresses.success-update'));
|
|
||||||
|
|
||||||
return redirect()->route('admin.customer.addresses.index', ['id' => $address->customer_id]);
|
|
||||||
}
|
|
||||||
return redirect()->route($this->_config['redirect']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -157,7 +148,7 @@ class AddressController extends Controller
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'redirect' => false,
|
'redirect' => false,
|
||||||
'message' => trans('admin::app.customers.addresses.success-delete')
|
'message' => trans('admin::app.customers.addresses.success-delete')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@ use Webkul\Admin\DataGrids\CustomerOrderDataGrid;
|
||||||
use Webkul\Admin\DataGrids\CustomersInvoicesDataGrid;
|
use Webkul\Admin\DataGrids\CustomersInvoicesDataGrid;
|
||||||
use Webkul\Admin\Http\Controllers\Controller;
|
use Webkul\Admin\Http\Controllers\Controller;
|
||||||
use Webkul\Admin\Mail\NewCustomerNotification;
|
use Webkul\Admin\Mail\NewCustomerNotification;
|
||||||
use Webkul\Core\Repositories\ChannelRepository;
|
|
||||||
use Webkul\Customer\Repositories\CustomerAddressRepository;
|
|
||||||
use Webkul\Customer\Repositories\CustomerGroupRepository;
|
use Webkul\Customer\Repositories\CustomerGroupRepository;
|
||||||
use Webkul\Customer\Repositories\CustomerRepository;
|
use Webkul\Customer\Repositories\CustomerRepository;
|
||||||
|
|
||||||
|
|
@ -26,15 +24,11 @@ class CustomerController extends Controller
|
||||||
* Create a new controller instance.
|
* Create a new controller instance.
|
||||||
*
|
*
|
||||||
* @param \Webkul\Customer\Repositories\CustomerRepository $customerRepository
|
* @param \Webkul\Customer\Repositories\CustomerRepository $customerRepository
|
||||||
* @param \Webkul\Customer\Repositories\CustomerAddressRepository $customerAddressRepository
|
|
||||||
* @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepository
|
* @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepository
|
||||||
* @param \Webkul\Core\Repositories\ChannelRepository $channelRepository
|
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected CustomerRepository $customerRepository,
|
protected CustomerRepository $customerRepository,
|
||||||
protected CustomerAddressRepository $customerAddressRepository,
|
protected CustomerGroupRepository $customerGroupRepository
|
||||||
protected CustomerGroupRepository $customerGroupRepository,
|
|
||||||
protected ChannelRepository $channelRepository
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$this->_config = request('_config');
|
$this->_config = request('_config');
|
||||||
|
|
@ -61,11 +55,9 @@ class CustomerController extends Controller
|
||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$customerGroup = $this->customerGroupRepository->findWhere([['code', '<>', 'guest']]);
|
$groups = $this->customerGroupRepository->findWhere([['code', '<>', 'guest']]);
|
||||||
|
|
||||||
$channelName = $this->channelRepository->all();
|
return view($this->_config['view'], compact('groups'));
|
||||||
|
|
||||||
return view($this->_config['view'], compact('customerGroup', 'channelName'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -83,18 +75,16 @@ class CustomerController extends Controller
|
||||||
'date_of_birth' => 'date|before:today',
|
'date_of_birth' => 'date|before:today',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$data = request()->all();
|
|
||||||
|
|
||||||
$password = rand(100000, 10000000);
|
$password = rand(100000, 10000000);
|
||||||
|
|
||||||
$data['password'] = bcrypt($password);
|
$customer = $this->customerRepository->create(array_merge(request()->all() , [
|
||||||
|
'password' => bcrypt($password),
|
||||||
$data['is_verified'] = 1;
|
'is_verified' => 1,
|
||||||
|
]));
|
||||||
$customer = $this->customerRepository->create($data);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$configKey = 'emails.general.notifications.emails.general.notifications.customer';
|
$configKey = 'emails.general.notifications.emails.general.notifications.customer';
|
||||||
|
|
||||||
if (core()->getConfigData($configKey)) {
|
if (core()->getConfigData($configKey)) {
|
||||||
Mail::queue(new NewCustomerNotification($customer, $password));
|
Mail::queue(new NewCustomerNotification($customer, $password));
|
||||||
}
|
}
|
||||||
|
|
@ -116,11 +106,10 @@ class CustomerController extends Controller
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$customer = $this->customerRepository->findOrFail($id);
|
$customer = $this->customerRepository->findOrFail($id);
|
||||||
$address = $this->customerAddressRepository->find($id);
|
|
||||||
$customerGroup = $this->customerGroupRepository->findWhere([['code', '<>', 'guest']]);
|
|
||||||
$channelName = $this->channelRepository->all();
|
|
||||||
|
|
||||||
return view($this->_config['view'], compact('customer', 'address', 'customerGroup', 'channelName'));
|
$groups = $this->customerGroupRepository->findWhere([['code', '<>', 'guest']]);
|
||||||
|
|
||||||
|
return view($this->_config['view'], compact('customer', 'groups'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -139,13 +128,10 @@ class CustomerController extends Controller
|
||||||
'date_of_birth' => 'date|before:today',
|
'date_of_birth' => 'date|before:today',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$data = request()->all();
|
$this->customerRepository->update(array_merge(request()->all(), [
|
||||||
|
'status' => isset($data['status']),
|
||||||
$data['status'] = ! isset($data['status']) ? 0 : 1;
|
'is_suspended' => isset($data['is_suspended']),
|
||||||
|
]), $id);
|
||||||
$data['is_suspended'] = ! isset($data['is_suspended']) ? 0 : 1;
|
|
||||||
|
|
||||||
$this->customerRepository->update($data, $id);
|
|
||||||
|
|
||||||
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Customer']));
|
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Customer']));
|
||||||
|
|
||||||
|
|
@ -203,11 +189,7 @@ class CustomerController extends Controller
|
||||||
|
|
||||||
$noteTaken = $customer->update(['notes' => request()->input('notes')]);
|
$noteTaken = $customer->update(['notes' => request()->input('notes')]);
|
||||||
|
|
||||||
if ($noteTaken) {
|
session()->flash('success', 'Note taken');
|
||||||
session()->flash('success', 'Note taken');
|
|
||||||
} else {
|
|
||||||
session()->flash('error', 'Note cannot be taken');
|
|
||||||
}
|
|
||||||
|
|
||||||
return redirect()->route($this->_config['redirect']);
|
return redirect()->route($this->_config['redirect']);
|
||||||
}
|
}
|
||||||
|
|
@ -220,6 +202,7 @@ class CustomerController extends Controller
|
||||||
public function massUpdate()
|
public function massUpdate()
|
||||||
{
|
{
|
||||||
$customerIds = explode(',', request()->input('indexes'));
|
$customerIds = explode(',', request()->input('indexes'));
|
||||||
|
|
||||||
$updateOption = request()->input('update-options');
|
$updateOption = request()->input('update-options');
|
||||||
|
|
||||||
foreach ($customerIds as $customerId) {
|
foreach ($customerIds as $customerId) {
|
||||||
|
|
@ -254,6 +237,7 @@ class CustomerController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
session()->flash('error', trans('admin::app.response.order-pending', ['name' => 'Customers']));
|
session()->flash('error', trans('admin::app.response.order-pending', ['name' => 'Customers']));
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,11 +62,9 @@ class CustomerGroupController extends Controller
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$data = request()->all();
|
$this->customerGroupRepository->create(array_merge(request()->all() , [
|
||||||
|
'is_user_defined' => 1,
|
||||||
$data['is_user_defined'] = 1;
|
]));
|
||||||
|
|
||||||
$this->customerGroupRepository->create($data);
|
|
||||||
|
|
||||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Customer Group']));
|
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Customer Group']));
|
||||||
|
|
||||||
|
|
@ -116,13 +114,13 @@ class CustomerGroupController extends Controller
|
||||||
{
|
{
|
||||||
$customerGroup = $this->customerGroupRepository->findOrFail($id);
|
$customerGroup = $this->customerGroupRepository->findOrFail($id);
|
||||||
|
|
||||||
if ($customerGroup->is_user_defined == 0) {
|
if (! $customerGroup->is_user_defined) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => trans('admin::app.customers.customers.group-default'),
|
'message' => trans('admin::app.customers.customers.group-default'),
|
||||||
], 400);
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($customerGroup->customers) > 0) {
|
if ($customerGroup->customers->count()) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => trans('admin::app.response.customer-associate', ['name' => 'Customer Group']),
|
'message' => trans('admin::app.response.customer-associate', ['name' => 'Customer Group']),
|
||||||
], 400);
|
], 400);
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,7 @@ class ExportController extends Controller
|
||||||
|
|
||||||
$gridName = explode('\\', $criteria['gridName']);
|
$gridName = explode('\\', $criteria['gridName']);
|
||||||
|
|
||||||
$path = '\Webkul\Admin\DataGrids' . '\\' . last($gridName);
|
$gridInstance = app('\Webkul\Admin\DataGrids' . '\\' . last($gridName));
|
||||||
|
|
||||||
$gridInstance = app($path);
|
|
||||||
|
|
||||||
$records = $gridInstance->export();
|
$records = $gridInstance->export();
|
||||||
|
|
||||||
|
|
@ -34,9 +32,7 @@ class ExportController extends Controller
|
||||||
|
|
||||||
if ($format == 'csv') {
|
if ($format == 'csv') {
|
||||||
return Excel::download(new DataGridExport($records), last($gridName) . '.csv');
|
return Excel::download(new DataGridExport($records), last($gridName) . '.csv');
|
||||||
}
|
} elseif ($format == 'xls') {
|
||||||
|
|
||||||
if ($format == 'xls') {
|
|
||||||
return Excel::download(new DataGridExport($records), last($gridName) . '.xlsx');
|
return Excel::download(new DataGridExport($records), last($gridName) . '.xlsx');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,21 +99,21 @@ class InvoiceController extends Controller
|
||||||
'invoice.items.*' => 'required|numeric|min:0',
|
'invoice.items.*' => 'required|numeric|min:0',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$data = request()->all();
|
if (! $this->invoiceRepository->haveProductToInvoice(request()->all())) {
|
||||||
|
|
||||||
if (! $this->invoiceRepository->haveProductToInvoice($data)) {
|
|
||||||
session()->flash('error', trans('admin::app.sales.invoices.product-error'));
|
session()->flash('error', trans('admin::app.sales.invoices.product-error'));
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $this->invoiceRepository->isValidQuantity($data)) {
|
if (! $this->invoiceRepository->isValidQuantity(request()->all())) {
|
||||||
session()->flash('error', trans('admin::app.sales.invoices.invalid-qty'));
|
session()->flash('error', trans('admin::app.sales.invoices.invalid-qty'));
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->invoiceRepository->create(array_merge($data, ['order_id' => $orderId]));
|
$this->invoiceRepository->create(array_merge(request()->all(), [
|
||||||
|
'order_id' => $orderId,
|
||||||
|
]));
|
||||||
|
|
||||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Invoice']));
|
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Invoice']));
|
||||||
|
|
||||||
|
|
@ -148,15 +148,9 @@ class InvoiceController extends Controller
|
||||||
|
|
||||||
$invoice = $this->invoiceRepository->findOrFail($id);
|
$invoice = $this->invoiceRepository->findOrFail($id);
|
||||||
|
|
||||||
if ($invoice) {
|
$this->sendDuplicateInvoiceMail($invoice, $request->email);
|
||||||
$this->sendDuplicateInvoiceMail($invoice, $request->email);
|
|
||||||
|
|
||||||
session()->flash('success', __('admin::app.sales.invoices.invoice-sent'));
|
session()->flash('success', trans('admin::app.sales.invoices.invoice-sent'));
|
||||||
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
session()->flash('error', __('admin::app.response.something-went-wrong'));
|
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,15 +86,12 @@ class OrderController extends Controller
|
||||||
*/
|
*/
|
||||||
public function comment($id)
|
public function comment($id)
|
||||||
{
|
{
|
||||||
$data = array_merge(request()->all(), [
|
Event::dispatch('sales.order.comment.create.before');
|
||||||
'order_id' => $id,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$data['customer_notified'] = isset($data['customer_notified']) ? 1 : 0;
|
$comment = $this->orderCommentRepository->create(array_merge(request()->all(), [
|
||||||
|
'order_id' => $id,
|
||||||
Event::dispatch('sales.order.comment.create.before', $data);
|
'customer_notified' => isset($data['customer_notified']),
|
||||||
|
]));
|
||||||
$comment = $this->orderCommentRepository->create($data);
|
|
||||||
|
|
||||||
Event::dispatch('sales.order.comment.create.after', $comment);
|
Event::dispatch('sales.order.comment.create.after', $comment);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,15 +88,15 @@ class ShipmentController extends Controller
|
||||||
'shipment.items.*.*' => 'required|numeric|min:0',
|
'shipment.items.*.*' => 'required|numeric|min:0',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$data = request()->all();
|
if (! $this->isInventoryValidate(request()->all())) {
|
||||||
|
|
||||||
if (! $this->isInventoryValidate($data)) {
|
|
||||||
session()->flash('error', trans('admin::app.sales.shipments.quantity-invalid'));
|
session()->flash('error', trans('admin::app.sales.shipments.quantity-invalid'));
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->shipmentRepository->create(array_merge($data, ['order_id' => $orderId]));
|
$this->shipmentRepository->create(array_merge(request()->all(), [
|
||||||
|
'order_id' => $orderId,
|
||||||
|
]));
|
||||||
|
|
||||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Shipment']));
|
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Shipment']));
|
||||||
|
|
||||||
|
|
@ -141,7 +141,10 @@ class ShipmentController extends Controller
|
||||||
->where('inventory_source_id', $inventorySourceId)
|
->where('inventory_source_id', $inventorySourceId)
|
||||||
->sum('qty');
|
->sum('qty');
|
||||||
|
|
||||||
if ($child->qty_to_ship < $finalQty || $availableQty < $finalQty) {
|
if (
|
||||||
|
$child->qty_to_ship < $finalQty
|
||||||
|
|| $availableQty < $finalQty
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -150,7 +153,10 @@ class ShipmentController extends Controller
|
||||||
->where('inventory_source_id', $inventorySourceId)
|
->where('inventory_source_id', $inventorySourceId)
|
||||||
->sum('qty');
|
->sum('qty');
|
||||||
|
|
||||||
if ($orderItem->qty_to_ship < $qty || $availableQty < $qty) {
|
if (
|
||||||
|
$orderItem->qty_to_ship < $qty
|
||||||
|
|| $availableQty < $qty
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ namespace Webkul\Admin\Listeners;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Webkul\User\Notifications\AdminUpdatePassword;
|
use Webkul\User\Notifications\AdminUpdatePassword;
|
||||||
use Webkul\Customer\Notifications\CustomerUpdatePassword;
|
use Webkul\Customer\Notifications\CustomerUpdatePassword;
|
||||||
|
use Webkul\Customer\Models\Customer;
|
||||||
|
use Webkul\User\Models\Admin;
|
||||||
|
|
||||||
class PasswordChange
|
class PasswordChange
|
||||||
{
|
{
|
||||||
|
|
@ -17,11 +19,9 @@ class PasswordChange
|
||||||
public function sendUpdatePasswordMail($adminOrCustomer)
|
public function sendUpdatePasswordMail($adminOrCustomer)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if ($adminOrCustomer instanceof \Webkul\Customer\Models\Customer) {
|
if ($adminOrCustomer instanceof Customer) {
|
||||||
Mail::queue(new CustomerUpdatePassword($adminOrCustomer));
|
Mail::queue(new CustomerUpdatePassword($adminOrCustomer));
|
||||||
}
|
} elseif ($adminOrCustomer instanceof Admin) {
|
||||||
|
|
||||||
if ($adminOrCustomer instanceof \Webkul\User\Models\Admin) {
|
|
||||||
Mail::queue(new AdminUpdatePassword($adminOrCustomer));
|
Mail::queue(new AdminUpdatePassword($adminOrCustomer));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ class CancelOrderAdminNotification extends Mailable
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||||
->to(core()->getAdminEmailDetails()['email'])
|
->to(core()->getAdminEmailDetails()['email'])
|
||||||
->subject(trans('shop::app.mail.order.cancel.subject'))
|
->subject(trans('shop::app.mail.order.cancel.subject'))
|
||||||
->view('shop::emails.sales.order-cancel-admin');
|
->view('shop::emails.sales.order-cancel-admin');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -22,8 +22,8 @@ class CancelOrderNotification extends Mailable
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||||
->to($this->order->customer_email, $this->order->customer_full_name)
|
->to($this->order->customer_email, $this->order->customer_full_name)
|
||||||
->subject(trans('shop::app.mail.order.cancel.subject'))
|
->subject(trans('shop::app.mail.order.cancel.subject'))
|
||||||
->view('shop::emails.sales.order-cancel');
|
->view('shop::emails.sales.order-cancel');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -21,7 +21,8 @@ class DuplicateInvoiceNotification extends Mailable
|
||||||
public $invoice,
|
public $invoice,
|
||||||
public $customerEmail
|
public $customerEmail
|
||||||
)
|
)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the message.
|
* Build the message.
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,15 @@ class InvoiceOverdueReminder extends Mailable
|
||||||
*
|
*
|
||||||
* @param \Webkul\Customer\Contracts\Customer $customer
|
* @param \Webkul\Customer\Contracts\Customer $customer
|
||||||
* @param \Webkul\Sales\Contracts\Invoice $invoice
|
* @param \Webkul\Sales\Contracts\Invoice $invoice
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public $customer,
|
public $customer,
|
||||||
public $invoice
|
public $invoice
|
||||||
)
|
)
|
||||||
{}
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the message.
|
* Build the message.
|
||||||
|
|
@ -31,8 +34,11 @@ class InvoiceOverdueReminder extends Mailable
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||||
->to($this->customer->email)
|
->to($this->customer->email)
|
||||||
->subject(trans('shop::app.mail.invoice.reminder.subject'))
|
->subject(trans('shop::app.mail.invoice.reminder.subject'))
|
||||||
->view('shop::emails.customer.invoice-reminder')->with(['customer' => $this->customer, 'invoice' => $this->invoice]);
|
->view('shop::emails.customer.invoice-reminder')->with([
|
||||||
|
'customer' => $this->customer,
|
||||||
|
'invoice' => $this->invoice,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -29,8 +29,8 @@ class NewAdminNotification extends Mailable
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||||
->to(core()->getAdminEmailDetails()['email'])
|
->to(core()->getAdminEmailDetails()['email'])
|
||||||
->subject(trans('shop::app.mail.order.subject'))
|
->subject(trans('shop::app.mail.order.subject'))
|
||||||
->view('shop::emails.sales.new-admin-order');
|
->view('shop::emails.sales.new-admin-order');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -33,8 +33,11 @@ class NewCustomerNotification extends Mailable
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||||
->to($this->customer->email)
|
->to($this->customer->email)
|
||||||
->subject(trans('shop::app.mail.customer.new.subject'))
|
->subject(trans('shop::app.mail.customer.new.subject'))
|
||||||
->view('shop::emails.customer.new-customer')->with(['customer' => $this->customer, 'password' => $this->password]);
|
->view('shop::emails.customer.new-customer')->with([
|
||||||
|
'customer' => $this->customer,
|
||||||
|
'password' => $this->password,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -33,8 +33,8 @@ class NewInventorySourceNotification extends Mailable
|
||||||
$inventory = $this->shipment->inventory_source;
|
$inventory = $this->shipment->inventory_source;
|
||||||
|
|
||||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||||
->to($inventory->contact_email, $inventory->name)
|
->to($inventory->contact_email, $inventory->name)
|
||||||
->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id]))
|
->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id]))
|
||||||
->view('shop::emails.sales.new-inventorysource-shipment');
|
->view('shop::emails.sales.new-inventorysource-shipment');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ class NewInvoiceNotification extends Mailable
|
||||||
$order = $this->invoice->order;
|
$order = $this->invoice->order;
|
||||||
|
|
||||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||||
->to($order->customer_email, $order->customer_full_name)
|
->to($order->customer_email, $order->customer_full_name)
|
||||||
->subject(trans('shop::app.mail.invoice.subject', ['order_id' => $order->increment_id]))
|
->subject(trans('shop::app.mail.invoice.subject', ['order_id' => $order->increment_id]))
|
||||||
->view('shop::emails.sales.new-invoice');
|
->view('shop::emails.sales.new-invoice');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ class NewOrderNotification extends Mailable
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||||
->to($this->order->customer_email, $this->order->customer_full_name)
|
->to($this->order->customer_email, $this->order->customer_full_name)
|
||||||
->subject(trans('shop::app.mail.order.subject'))
|
->subject(trans('shop::app.mail.order.subject'))
|
||||||
->view('shop::emails.sales.new-order');
|
->view('shop::emails.sales.new-order');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ class NewRefundNotification extends Mailable
|
||||||
$order = $this->refund->order;
|
$order = $this->refund->order;
|
||||||
|
|
||||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||||
->to($order->customer_email, $order->customer_full_name)
|
->to($order->customer_email, $order->customer_full_name)
|
||||||
->subject(trans('shop::app.mail.refund.subject', ['order_id' => $order->increment_id]))
|
->subject(trans('shop::app.mail.refund.subject', ['order_id' => $order->increment_id]))
|
||||||
->view('shop::emails.sales.new-refund');
|
->view('shop::emails.sales.new-refund');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ class NewShipmentNotification extends Mailable
|
||||||
$order = $this->shipment->order;
|
$order = $this->shipment->order;
|
||||||
|
|
||||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||||
->to($order->customer_email, $order->customer_full_name)
|
->to($order->customer_email, $order->customer_full_name)
|
||||||
->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id]))
|
->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->increment_id]))
|
||||||
->view('shop::emails.sales.new-shipment');
|
->view('shop::emails.sales.new-shipment');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ class OrderCommentNotification extends Mailable
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||||
->to($this->comment->order->customer_email, $this->comment->order->customer_full_name)
|
->to($this->comment->order->customer_email, $this->comment->order->customer_full_name)
|
||||||
->subject(trans('shop::app.mail.order.comment.subject', ['order_id' => $this->comment->order->increment_id]))
|
->subject(trans('shop::app.mail.order.comment.subject', ['order_id' => $this->comment->order->increment_id]))
|
||||||
->view('shop::emails.sales.new-order-comment');
|
->view('shop::emails.sales.new-order-comment');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,13 +105,15 @@ class AdminServiceProvider extends ServiceProvider
|
||||||
&& substr_count($item['key'], '.') == 1
|
&& substr_count($item['key'], '.') == 1
|
||||||
) {
|
) {
|
||||||
foreach ($allowedPermissions as $key => $value) {
|
foreach ($allowedPermissions as $key => $value) {
|
||||||
if ($item['key'] == $value) {
|
if ($item['key'] != $value) {
|
||||||
$neededItem = $allowedPermissions[$key + 1];
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (config('menu.admin') as $key1 => $findMatced) {
|
$neededItem = $allowedPermissions[$key + 1];
|
||||||
if ($findMatced['key'] == $neededItem) {
|
|
||||||
$item['route'] = $findMatced['route'];
|
foreach (config('menu.admin') as $key1 => $findMatced) {
|
||||||
}
|
if ($findMatced['key'] == $neededItem) {
|
||||||
|
$item['route'] = $findMatced['route'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var groups = @json($attributeFamily ? $attributeFamily->attribute_groups : []);
|
var groups = @json($attributeFamily ? $attributeFamily->attribute_groups : []);
|
||||||
var custom_attributes = @json($custom_attributes);
|
var custom_attributes = @json($customAttributes);
|
||||||
|
|
||||||
Vue.component('group-list', {
|
Vue.component('group-list', {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var groups = @json($attributeFamily->attribute_groups);
|
var groups = @json($attributeFamily->attribute_groups);
|
||||||
var custom_attributes = @json($custom_attributes);
|
var custom_attributes = @json($customAttributes);
|
||||||
|
|
||||||
Vue.component('group-list', {
|
Vue.component('group-list', {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>
|
<label for="customerGroup" >{{ __('admin::app.customers.customers.customer_group') }}</label>
|
||||||
<select class="control" id="customerGroup" name="customer_group_id">
|
<select class="control" id="customerGroup" name="customer_group_id">
|
||||||
@foreach ($customerGroup as $group)
|
@foreach ($groups as $group)
|
||||||
<option value="{{ $group->id }}"> {{ $group->name}} </>
|
<option value="{{ $group->id }}"> {{ $group->name}} </>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<select class="control" id="customerGroup" name="customer_group_id">
|
<select class="control" id="customerGroup" name="customer_group_id">
|
||||||
@foreach ($customerGroup as $group)
|
@foreach ($groups as $group)
|
||||||
<option value="{{ $group->id }}" {{ $selectedCustomerOption == $group->id ? 'selected' : '' }}>
|
<option value="{{ $group->id }}" {{ $selectedCustomerOption == $group->id ? 'selected' : '' }}>
|
||||||
{{ $group->name}}
|
{{ $group->name}}
|
||||||
</option>
|
</option>
|
||||||
|
|
|
||||||
|
|
@ -62,11 +62,9 @@ class AttributeController extends Controller
|
||||||
'type' => 'required',
|
'type' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$data = request()->all();
|
$this->attributeRepository->create(array_merge(request()->all(), [
|
||||||
|
'is_user_defined' => 1,
|
||||||
$data['is_user_defined'] = 1;
|
]));
|
||||||
|
|
||||||
$this->attributeRepository->create($data);
|
|
||||||
|
|
||||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Attribute']));
|
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Attribute']));
|
||||||
|
|
||||||
|
|
@ -170,12 +168,10 @@ class AttributeController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success', ['resource' => 'attributes']));
|
session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success', ['resource' => 'attributes']));
|
||||||
|
|
||||||
return redirect()->back();
|
|
||||||
} else {
|
} else {
|
||||||
session()->flash('error', trans('admin::app.datagrid.mass-ops.method-error'));
|
session()->flash('error', trans('admin::app.datagrid.mass-ops.method-error'));
|
||||||
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,9 @@ class AttributeFamilyController extends Controller
|
||||||
{
|
{
|
||||||
$attributeFamily = $this->attributeFamilyRepository->with(['attribute_groups.custom_attributes'])->findOneByField('code', 'default');
|
$attributeFamily = $this->attributeFamilyRepository->with(['attribute_groups.custom_attributes'])->findOneByField('code', 'default');
|
||||||
|
|
||||||
$custom_attributes = $this->attributeRepository->all(['id', 'code', 'admin_name', 'type']);
|
$customAttributes = $this->attributeRepository->all(['id', 'code', 'admin_name', 'type']);
|
||||||
|
|
||||||
return view($this->_config['view'], compact('custom_attributes', 'attributeFamily'));
|
return view($this->_config['view'], compact('attributeFamily', 'customAttributes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -87,9 +87,9 @@ class AttributeFamilyController extends Controller
|
||||||
{
|
{
|
||||||
$attributeFamily = $this->attributeFamilyRepository->with(['attribute_groups.custom_attributes'])->findOrFail($id, ['*']);
|
$attributeFamily = $this->attributeFamilyRepository->with(['attribute_groups.custom_attributes'])->findOrFail($id, ['*']);
|
||||||
|
|
||||||
$custom_attributes = $this->attributeRepository->all(['id', 'code', 'admin_name', 'type']);
|
$customAttributes = $this->attributeRepository->all(['id', 'code', 'admin_name', 'type']);
|
||||||
|
|
||||||
return view($this->_config['view'], compact('attributeFamily', 'custom_attributes'));
|
return view($this->_config['view'], compact('attributeFamily', 'customAttributes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2,29 +2,30 @@
|
||||||
|
|
||||||
namespace Webkul\Attribute\Repositories;
|
namespace Webkul\Attribute\Repositories;
|
||||||
|
|
||||||
use Webkul\Core\Eloquent\Repository;
|
use Illuminate\Container\Container;
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Webkul\Core\Eloquent\Repository;
|
||||||
use Webkul\Attribute\Repositories\AttributeRepository;
|
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||||
use Webkul\Attribute\Repositories\AttributeGroupRepository;
|
use Webkul\Attribute\Repositories\AttributeGroupRepository;
|
||||||
use Illuminate\Container\Container as App;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
class AttributeFamilyRepository extends Repository
|
class AttributeFamilyRepository extends Repository
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new controller instance.
|
* Create a new repository instance.
|
||||||
*
|
*
|
||||||
* @param \Webkul\Attribute\Repositories\AttributeRepository $attributeRepository
|
* @param \Webkul\Attribute\Repositories\AttributeRepository $attributeRepository
|
||||||
* @param \Webkul\Attribute\Repositories\AttributeGroupRepository $attributeGroupRepository
|
* @param \Webkul\Attribute\Repositories\AttributeGroupRepository $attributeGroupRepository
|
||||||
|
* @param \Illuminate\Container\Container $container
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected AttributeRepository $attributeRepository,
|
protected AttributeRepository $attributeRepository,
|
||||||
protected AttributeGroupRepository $attributeGroupRepository,
|
protected AttributeGroupRepository $attributeGroupRepository,
|
||||||
App $app
|
Container $container
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
parent::__construct($app);
|
parent::__construct($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace Webkul\Attribute\Repositories;
|
namespace Webkul\Attribute\Repositories;
|
||||||
|
|
||||||
use Illuminate\Container\Container as App;
|
use Illuminate\Container\Container;
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
use Webkul\Attribute\Repositories\AttributeOptionRepository;
|
use Webkul\Attribute\Repositories\AttributeOptionRepository;
|
||||||
use Webkul\Core\Eloquent\Repository;
|
use Webkul\Core\Eloquent\Repository;
|
||||||
|
|
@ -13,14 +13,15 @@ class AttributeRepository extends Repository
|
||||||
* Create a new repository instance.
|
* Create a new repository instance.
|
||||||
*
|
*
|
||||||
* @param \Webkul\Attribute\Repositories\AttributeOptionRepository $attributeOptionRepository
|
* @param \Webkul\Attribute\Repositories\AttributeOptionRepository $attributeOptionRepository
|
||||||
|
* @param \Illuminate\Container\Container $container
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected AttributeOptionRepository $attributeOptionRepository,
|
protected AttributeOptionRepository $attributeOptionRepository,
|
||||||
App $app
|
Container $container
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
parent::__construct($app);
|
parent::__construct($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -260,29 +261,19 @@ class AttributeRepository extends Repository
|
||||||
foreach ($attributes as $key => $attribute) {
|
foreach ($attributes as $key => $attribute) {
|
||||||
if (
|
if (
|
||||||
$attribute->code != 'tax_category_id'
|
$attribute->code != 'tax_category_id'
|
||||||
&& ($attribute->type == 'select'
|
&& (
|
||||||
|| $attribute->type == 'multiselect'
|
in_array($attribute->type ,['select', 'multiselect'])
|
||||||
|| $attribute->code == 'sku')
|
|| $attribute->code == 'sku'
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
if ($attribute->options()->exists()) {
|
array_push($trimmed, [
|
||||||
array_push($trimmed, [
|
'id' => $attribute->id,
|
||||||
'id' => $attribute->id,
|
'name' => $attribute->admin_name,
|
||||||
'name' => $attribute->admin_name,
|
'type' => $attribute->type,
|
||||||
'type' => $attribute->type,
|
'code' => $attribute->code,
|
||||||
'code' => $attribute->code,
|
'has_options' => $attribute->options()->exists(),
|
||||||
'has_options' => true,
|
'options' => $attribute->options,
|
||||||
'options' => $attribute->options,
|
]);
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
array_push($trimmed, [
|
|
||||||
'id' => $attribute->id,
|
|
||||||
'name' => $attribute->admin_name,
|
|
||||||
'type' => $attribute->type,
|
|
||||||
'code' => $attribute->code,
|
|
||||||
'has_options' => false,
|
|
||||||
'options' => null,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,6 @@ class PageController extends Controller
|
||||||
*/
|
*/
|
||||||
public function store()
|
public function store()
|
||||||
{
|
{
|
||||||
$data = request()->all();
|
|
||||||
|
|
||||||
$this->validate(request(), [
|
$this->validate(request(), [
|
||||||
'url_key' => ['required', 'unique:cms_page_translations,url_key', new \Webkul\Core\Contracts\Validations\Slug],
|
'url_key' => ['required', 'unique:cms_page_translations,url_key', new \Webkul\Core\Contracts\Validations\Slug],
|
||||||
'page_title' => 'required',
|
'page_title' => 'required',
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,10 @@ class CartRule
|
||||||
{
|
{
|
||||||
$appliedCartRuleIds = [];
|
$appliedCartRuleIds = [];
|
||||||
|
|
||||||
$this->calculateCartItemTotals($cart, $cart->items);
|
$this->calculateCartItemTotals($cart);
|
||||||
|
|
||||||
foreach ($cart->items as $item) {
|
foreach ($cart->items as $item) {
|
||||||
$itemCartRuleIds = $this->process($cart, $item);
|
$itemCartRuleIds = $this->process($item);
|
||||||
|
|
||||||
$appliedCartRuleIds = array_merge($appliedCartRuleIds, $itemCartRuleIds);
|
$appliedCartRuleIds = array_merge($appliedCartRuleIds, $itemCartRuleIds);
|
||||||
|
|
||||||
|
|
@ -132,41 +132,41 @@ class CartRule
|
||||||
public function canProcessRule($cart, $rule): bool
|
public function canProcessRule($cart, $rule): bool
|
||||||
{
|
{
|
||||||
if ($rule->coupon_type) {
|
if ($rule->coupon_type) {
|
||||||
if (strlen($cart->coupon_code)) {
|
if (! strlen($cart->coupon_code)) {
|
||||||
/** @var \Webkul\CartRule\Models\CartRule $rule */
|
return false;
|
||||||
// Laravel relation is used instead of repository for performance
|
}
|
||||||
// reasons (cart_rule_coupon-relation is pre-loaded by self::getCartRuleQuery())
|
|
||||||
$coupon = $rule->cart_rule_coupon()->where('code', $cart->coupon_code)->first();
|
/** @var \Webkul\CartRule\Models\CartRule $rule */
|
||||||
|
// Laravel relation is used instead of repository for performance
|
||||||
|
// reasons (cart_rule_coupon-relation is pre-loaded by self::getCartRuleQuery())
|
||||||
|
$coupon = $rule->cart_rule_coupon()->where('code', $cart->coupon_code)->first();
|
||||||
|
|
||||||
|
if (
|
||||||
|
$coupon
|
||||||
|
&& $coupon->code === $cart->coupon_code
|
||||||
|
) {
|
||||||
|
if (
|
||||||
|
$coupon->usage_limit
|
||||||
|
&& $coupon->times_used >= $coupon->usage_limit
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$coupon
|
$cart->customer_id
|
||||||
&& $coupon->code === $cart->coupon_code
|
&& $coupon->usage_per_customer
|
||||||
) {
|
) {
|
||||||
|
$couponUsage = $this->cartRuleCouponUsageRepository->findOneWhere([
|
||||||
|
'cart_rule_coupon_id' => $coupon->id,
|
||||||
|
'customer_id' => $cart->customer_id,
|
||||||
|
]);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$coupon->usage_limit
|
$couponUsage
|
||||||
&& $coupon->times_used >= $coupon->usage_limit
|
&& $couponUsage->times_used >= $coupon->usage_per_customer
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
|
||||||
$cart->customer_id
|
|
||||||
&& $coupon->usage_per_customer
|
|
||||||
) {
|
|
||||||
$couponUsage = $this->cartRuleCouponUsageRepository->findOneWhere([
|
|
||||||
'cart_rule_coupon_id' => $coupon->id,
|
|
||||||
'customer_id' => $cart->customer_id,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (
|
|
||||||
$couponUsage
|
|
||||||
&& $couponUsage->times_used >= $coupon->usage_per_customer
|
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -193,11 +193,10 @@ class CartRule
|
||||||
/**
|
/**
|
||||||
* Cart item discount calculation process
|
* Cart item discount calculation process
|
||||||
*
|
*
|
||||||
* @param \Webkul\Checkout\Contracts\Cart $cart
|
|
||||||
* @param \Webkul\Checkout\Models\CartItem $item
|
* @param \Webkul\Checkout\Models\CartItem $item
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function process($cart, CartItem $item): array
|
public function process(CartItem $item): array
|
||||||
{
|
{
|
||||||
$item->discount_percent = 0;
|
$item->discount_percent = 0;
|
||||||
$item->discount_amount = 0;
|
$item->discount_amount = 0;
|
||||||
|
|
@ -205,8 +204,8 @@ class CartRule
|
||||||
|
|
||||||
$appliedRuleIds = [];
|
$appliedRuleIds = [];
|
||||||
|
|
||||||
foreach ($rules = $this->getCartRules($cart) as $rule) {
|
foreach ($rules = $this->getCartRules($item->cart) as $rule) {
|
||||||
if (! $this->canProcessRule($cart, $rule)) {
|
if (! $this->canProcessRule($item->cart, $rule)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -319,7 +318,7 @@ class CartRule
|
||||||
* Cart shipping discount calculation process
|
* Cart shipping discount calculation process
|
||||||
*
|
*
|
||||||
* @param \Webkul\Checkout\Contracts\Cart $cart
|
* @param \Webkul\Checkout\Contracts\Cart $cart
|
||||||
* @return void
|
* @return self|void
|
||||||
*/
|
*/
|
||||||
public function processShippingDiscount($cart)
|
public function processShippingDiscount($cart)
|
||||||
{
|
{
|
||||||
|
|
@ -418,9 +417,7 @@ class CartRule
|
||||||
$appliedRuleIds = [];
|
$appliedRuleIds = [];
|
||||||
|
|
||||||
foreach ($cart->items->all() as $item) {
|
foreach ($cart->items->all() as $item) {
|
||||||
|
|
||||||
foreach ($this->getCartRules($cart) as $rule) {
|
foreach ($this->getCartRules($cart) as $rule) {
|
||||||
|
|
||||||
if (! $this->canProcessRule($cart, $rule)) {
|
if (! $this->canProcessRule($cart, $rule)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -466,36 +463,37 @@ class CartRule
|
||||||
* Calculate cart item totals for each rule
|
* Calculate cart item totals for each rule
|
||||||
*
|
*
|
||||||
* @param \Webkul\Checkout\Contracts\Cart $cart
|
* @param \Webkul\Checkout\Contracts\Cart $cart
|
||||||
* @param \Illuminate\Support\Collecton $items
|
* @return array|void
|
||||||
* @return \Webkul\Rule\Helpers\Validator
|
|
||||||
*/
|
*/
|
||||||
public function calculateCartItemTotals($cart, $items)
|
public function calculateCartItemTotals($cart)
|
||||||
{
|
{
|
||||||
foreach ($this->getCartRules($cart) as $rule) {
|
foreach ($this->getCartRules($cart) as $rule) {
|
||||||
if ($rule->action_type == 'cart_fixed') {
|
if ($rule->action_type != 'cart_fixed') {
|
||||||
$totalPrice = $totalBasePrice = $validCount = 0;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($items as $item) {
|
$totalPrice = $totalBasePrice = $validCount = 0;
|
||||||
if (! $this->canProcessRule($cart, $rule)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $this->validator->validate($rule, $item)) {
|
foreach ($cart->items as $item) {
|
||||||
continue;
|
if (! $this->canProcessRule($cart, $rule)) {
|
||||||
}
|
continue;
|
||||||
|
|
||||||
$quantity = $rule->discount_quantity ? min($item->quantity, $rule->discount_quantity) : $item->quantity;
|
|
||||||
|
|
||||||
$totalBasePrice += $item->base_price * $quantity;
|
|
||||||
|
|
||||||
$validCount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->itemTotals[$rule->id] = [
|
if (! $this->validator->validate($rule, $item)) {
|
||||||
'base_total_price' => $totalBasePrice,
|
continue;
|
||||||
'total_items' => $validCount,
|
}
|
||||||
];
|
|
||||||
|
$quantity = $rule->discount_quantity ? min($item->quantity, $rule->discount_quantity) : $item->quantity;
|
||||||
|
|
||||||
|
$totalBasePrice += $item->base_price * $quantity;
|
||||||
|
|
||||||
|
$validCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->itemTotals[$rule->id] = [
|
||||||
|
'base_total_price' => $totalBasePrice,
|
||||||
|
'total_items' => $validCount,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -546,9 +544,8 @@ class CartRule
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $customerGroupId
|
* @param integer $customerGroupId
|
||||||
* @param $channelId
|
* @param integer $channelId
|
||||||
*
|
|
||||||
* @return \Illuminate\Database\Eloquent\Collection
|
* @return \Illuminate\Database\Eloquent\Collection
|
||||||
*/
|
*/
|
||||||
public function getCartRuleQuery($customerGroupId, $channelId): \Illuminate\Database\Eloquent\Collection
|
public function getCartRuleQuery($customerGroupId, $channelId): \Illuminate\Database\Eloquent\Collection
|
||||||
|
|
|
||||||
|
|
@ -99,9 +99,7 @@ class CartRuleController extends Controller
|
||||||
public function store(CartRuleRequest $cartRuleRequest)
|
public function store(CartRuleRequest $cartRuleRequest)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$data = $cartRuleRequest->all();
|
$this->cartRuleRepository->create($cartRuleRequest->all());
|
||||||
|
|
||||||
$this->cartRuleRepository->create($data);
|
|
||||||
|
|
||||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Cart Rule']));
|
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Cart Rule']));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,10 @@ class CartRuleRequest extends FormRequest
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request()->has('action_type') && request()->action_type == 'by_percent') {
|
if (
|
||||||
|
request()->has('action_type')
|
||||||
|
&& request()->action_type == 'by_percent'
|
||||||
|
) {
|
||||||
$rules = array_merge($rules, [
|
$rules = array_merge($rules, [
|
||||||
'discount_amount' => 'required|numeric|min:0|max:100',
|
'discount_amount' => 'required|numeric|min:0|max:100',
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ class CartRuleRepository extends Repository
|
||||||
|
|
||||||
$data['ends_till'] = isset($data['ends_till']) && $data['ends_till'] ? $data['ends_till'] : null;
|
$data['ends_till'] = isset($data['ends_till']) && $data['ends_till'] ? $data['ends_till'] : null;
|
||||||
|
|
||||||
$data['status'] = ! isset($data['status']) ? 0 : 1;
|
$data['status'] = isset($data['status']);
|
||||||
|
|
||||||
$cartRule = parent::create($data);
|
$cartRule = parent::create($data);
|
||||||
|
|
||||||
|
|
@ -100,13 +100,12 @@ class CartRuleRepository extends Repository
|
||||||
{
|
{
|
||||||
Event::dispatch('promotions.cart_rule.update.before', $id);
|
Event::dispatch('promotions.cart_rule.update.before', $id);
|
||||||
|
|
||||||
$data['starts_from'] = $data['starts_from'] ?: null;
|
$data = array_merge($data, [
|
||||||
|
'starts_from' => $data['starts_from'] ?: null,
|
||||||
$data['ends_till'] = $data['ends_till'] ?: null;
|
'ends_till' => $data['ends_till'] ?: null,
|
||||||
|
'status' => isset($data['status']),
|
||||||
$data['status'] = ! isset($data['status']) ? 0 : 1;
|
'conditions' => $data['conditions'] ?? [],
|
||||||
|
]);
|
||||||
$data['conditions'] = $data['conditions'] ?? [];
|
|
||||||
|
|
||||||
$cartRule = $this->find($id);
|
$cartRule = $this->find($id);
|
||||||
|
|
||||||
|
|
@ -118,7 +117,10 @@ class CartRuleRepository extends Repository
|
||||||
|
|
||||||
if ($data['coupon_type']) {
|
if ($data['coupon_type']) {
|
||||||
if (! $data['use_auto_generation']) {
|
if (! $data['use_auto_generation']) {
|
||||||
$cartRuleCoupon = $this->cartRuleCouponRepository->findOneWhere(['is_primary' => 1, 'cart_rule_id' => $cartRule->id]);
|
$cartRuleCoupon = $this->cartRuleCouponRepository->findOneWhere([
|
||||||
|
'is_primary' => 1,
|
||||||
|
'cart_rule_id' => $cartRule->id,
|
||||||
|
]);
|
||||||
|
|
||||||
if ($cartRuleCoupon) {
|
if ($cartRuleCoupon) {
|
||||||
$this->cartRuleCouponRepository->update([
|
$this->cartRuleCouponRepository->update([
|
||||||
|
|
@ -138,7 +140,10 @@ class CartRuleRepository extends Repository
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->cartRuleCouponRepository->deleteWhere(['is_primary' => 1, 'cart_rule_id' => $cartRule->id]);
|
$this->cartRuleCouponRepository->deleteWhere([
|
||||||
|
'is_primary' => 1,
|
||||||
|
'cart_rule_id' => $cartRule->id,
|
||||||
|
]);
|
||||||
|
|
||||||
$this->cartRuleCouponRepository->getModel()->where('cart_rule_id', $cartRule->id)->update([
|
$this->cartRuleCouponRepository->getModel()->where('cart_rule_id', $cartRule->id)->update([
|
||||||
'usage_limit' => $data['uses_per_coupon'] ?? 0,
|
'usage_limit' => $data['uses_per_coupon'] ?? 0,
|
||||||
|
|
@ -282,9 +287,7 @@ class CartRuleRepository extends Repository
|
||||||
|
|
||||||
if ($attribute->validation == 'decimal') {
|
if ($attribute->validation == 'decimal') {
|
||||||
$attributeType = 'decimal';
|
$attributeType = 'decimal';
|
||||||
}
|
} elseif ($attribute->validation == 'numeric') {
|
||||||
|
|
||||||
if ($attribute->validation == 'numeric') {
|
|
||||||
$attributeType = 'integer';
|
$attributeType = 'integer';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,8 @@ class CatalogRuleIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
$productIds = $product->getTypeInstance()->isComposite()
|
$productIds = $product->getTypeInstance()->isComposite()
|
||||||
? $product->getTypeInstance()->getChildrenIds()
|
? $product->getTypeInstance()->getChildrenIds()
|
||||||
: [$product->id];
|
: [$product->id];
|
||||||
|
|
||||||
$this->cleanIndexes($productIds);
|
$this->cleanIndexes($productIds);
|
||||||
|
|
||||||
|
|
@ -100,14 +100,14 @@ class CatalogRuleIndex
|
||||||
|
|
||||||
$catalogRules = $this->catalogRuleRepository->scopeQuery(function($query) {
|
$catalogRules = $this->catalogRuleRepository->scopeQuery(function($query) {
|
||||||
return $query->where(function ($query1) {
|
return $query->where(function ($query1) {
|
||||||
$query1->where('catalog_rules.starts_from', '<=', Carbon::now()->format('Y-m-d'))
|
$query1->where('catalog_rules.starts_from', '<=', Carbon::now()->format('Y-m-d'))
|
||||||
->orWhereNull('catalog_rules.starts_from');
|
->orWhereNull('catalog_rules.starts_from');
|
||||||
})
|
})
|
||||||
->where(function ($query2) {
|
->where(function ($query2) {
|
||||||
$query2->where('catalog_rules.ends_till', '>=', Carbon::now()->format('Y-m-d'))
|
$query2->where('catalog_rules.ends_till', '>=', Carbon::now()->format('Y-m-d'))
|
||||||
->orWhereNull('catalog_rules.ends_till');
|
->orWhereNull('catalog_rules.ends_till');
|
||||||
})
|
})
|
||||||
->orderBy('sort_order', 'asc');
|
->orderBy('sort_order', 'asc');
|
||||||
})->findWhere(['status' => 1]);
|
})->findWhere(['status' => 1]);
|
||||||
|
|
||||||
return $catalogRules;
|
return $catalogRules;
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,9 @@ class CatalogRuleProduct
|
||||||
*/
|
*/
|
||||||
public function insertRuleProduct($rule, $batchCount = 1000, $product = null)
|
public function insertRuleProduct($rule, $batchCount = 1000, $product = null)
|
||||||
{
|
{
|
||||||
if (! (float) $rule->discount_amount)
|
if (! (float) $rule->discount_amount) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$productIds = $this->getMatchingProductIds($rule, $product);
|
$productIds = $this->getMatchingProductIds($rule, $product);
|
||||||
|
|
||||||
|
|
@ -90,10 +91,10 @@ class CatalogRuleProduct
|
||||||
{
|
{
|
||||||
$qb = $this->productRepository->scopeQuery(function($query) use($rule, $product) {
|
$qb = $this->productRepository->scopeQuery(function($query) use($rule, $product) {
|
||||||
$qb = $query->distinct()
|
$qb = $query->distinct()
|
||||||
->addSelect('products.*')
|
->addSelect('products.*')
|
||||||
->leftJoin('product_flat', 'products.id', '=', 'product_flat.product_id')
|
->leftJoin('product_flat', 'products.id', '=', 'product_flat.product_id')
|
||||||
->leftJoin('channels', 'product_flat.channel', '=', 'channels.code')
|
->leftJoin('channels', 'product_flat.channel', '=', 'channels.code')
|
||||||
->whereIn('channels.id', $rule->channels()->pluck('id')->toArray());
|
->whereIn('channels.id', $rule->channels()->pluck('id')->toArray());
|
||||||
|
|
||||||
if ($product) {
|
if ($product) {
|
||||||
$qb->where('products.id', $product->id);
|
$qb->where('products.id', $product->id);
|
||||||
|
|
@ -162,7 +163,7 @@ class CatalogRuleProduct
|
||||||
|
|
||||||
$query = $query->leftJoin('product_attribute_values as ' . 'pav_' . $attribute->code, function($qb) use($attribute) {
|
$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)
|
$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')
|
$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);
|
||||||
|
|
@ -183,13 +184,13 @@ class CatalogRuleProduct
|
||||||
{
|
{
|
||||||
$results = $this->catalogRuleProductRepository->scopeQuery(function($query) use($product) {
|
$results = $this->catalogRuleProductRepository->scopeQuery(function($query) use($product) {
|
||||||
$qb = $query->distinct()
|
$qb = $query->distinct()
|
||||||
->select('catalog_rule_products.*')
|
->select('catalog_rule_products.*')
|
||||||
->leftJoin('products', 'catalog_rule_products.product_id', '=', 'products.id')
|
->leftJoin('products', 'catalog_rule_products.product_id', '=', 'products.id')
|
||||||
->orderBy('channel_id', 'asc')
|
->orderBy('channel_id', 'asc')
|
||||||
->orderBy('customer_group_id', 'asc')
|
->orderBy('customer_group_id', 'asc')
|
||||||
->orderBy('product_id', 'asc')
|
->orderBy('product_id', 'asc')
|
||||||
->orderBy('sort_order', 'asc')
|
->orderBy('sort_order', 'asc')
|
||||||
->orderBy('catalog_rule_id', 'asc');
|
->orderBy('catalog_rule_id', 'asc');
|
||||||
|
|
||||||
$qb = $this->addAttributeToSelect('price', $qb);
|
$qb = $this->addAttributeToSelect('price', $qb);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,7 @@ class CatalogRuleController extends Controller
|
||||||
*/
|
*/
|
||||||
public function store(CatalogRuleRequest $catalogRuleRequest)
|
public function store(CatalogRuleRequest $catalogRuleRequest)
|
||||||
{
|
{
|
||||||
$data = $catalogRuleRequest->all();
|
$this->catalogRuleRepository->create($catalogRuleRequest->all());
|
||||||
|
|
||||||
$this->catalogRuleRepository->create($data);
|
|
||||||
|
|
||||||
$this->catalogRuleIndexHelper->reindexComplete();
|
$this->catalogRuleIndexHelper->reindexComplete();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,11 +53,11 @@ class CatalogRuleRepository extends Repository
|
||||||
{
|
{
|
||||||
Event::dispatch('promotions.catalog_rule.create.before');
|
Event::dispatch('promotions.catalog_rule.create.before');
|
||||||
|
|
||||||
$data['starts_from'] = $data['starts_from'] ?: null;
|
$data = array_merge($data, [
|
||||||
|
'starts_from' => $data['starts_from'] ?: null,
|
||||||
$data['ends_till'] = $data['ends_till'] ?: null;
|
'ends_till' => $data['ends_till'] ?: null,
|
||||||
|
'status' => isset($data['status']),
|
||||||
$data['status'] = ! isset($data['status']) ? 0 : 1;
|
]);
|
||||||
|
|
||||||
$catalogRule = parent::create($data);
|
$catalogRule = parent::create($data);
|
||||||
|
|
||||||
|
|
@ -82,13 +82,12 @@ class CatalogRuleRepository extends Repository
|
||||||
{
|
{
|
||||||
Event::dispatch('promotions.catalog_rule.update.before', $id);
|
Event::dispatch('promotions.catalog_rule.update.before', $id);
|
||||||
|
|
||||||
$data['starts_from'] = $data['starts_from'] ?: null;
|
$data = array_merge($data, [
|
||||||
|
'starts_from' => $data['starts_from'] ?: null,
|
||||||
$data['ends_till'] = $data['ends_till'] ?: null;
|
'ends_till' => $data['ends_till'] ?: null,
|
||||||
|
'status' => isset($data['status']),
|
||||||
$data['status'] = ! isset($data['status']) ? 0 : 1;
|
'conditions' => $data['conditions'] ?? [],
|
||||||
|
]);
|
||||||
$data['conditions'] = $data['conditions'] ?? [];
|
|
||||||
|
|
||||||
$catalogRule = $this->find($id);
|
$catalogRule = $this->find($id);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,7 @@ class CategoryController extends Controller
|
||||||
public function massDestroy()
|
public function massDestroy()
|
||||||
{
|
{
|
||||||
$suppressFlash = true;
|
$suppressFlash = true;
|
||||||
|
|
||||||
$categoryIds = explode(',', request()->input('indexes'));
|
$categoryIds = explode(',', request()->input('indexes'));
|
||||||
|
|
||||||
foreach ($categoryIds as $categoryId) {
|
foreach ($categoryIds as $categoryId) {
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ class CategoryRepository extends Repository
|
||||||
foreach ($model->translatedAttributes as $attribute) {
|
foreach ($model->translatedAttributes as $attribute) {
|
||||||
if (isset($data[$attribute])) {
|
if (isset($data[$attribute])) {
|
||||||
$data[$locale->code][$attribute] = $data[$attribute];
|
$data[$locale->code][$attribute] = $data[$attribute];
|
||||||
|
|
||||||
$data[$locale->code]['locale_id'] = $locale->id;
|
$data[$locale->code]['locale_id'] = $locale->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -237,6 +238,7 @@ class CategoryRepository extends Repository
|
||||||
|
|
||||||
foreach ($data[$type] as $imageId => $image) {
|
foreach ($data[$type] as $imageId => $image) {
|
||||||
$file = $type . '.' . $imageId;
|
$file = $type . '.' . $imageId;
|
||||||
|
|
||||||
$dir = 'category/' . $category->id;
|
$dir = 'category/' . $category->id;
|
||||||
|
|
||||||
if ($request->hasFile($file)) {
|
if ($request->hasFile($file)) {
|
||||||
|
|
@ -245,6 +247,7 @@ class CategoryRepository extends Repository
|
||||||
}
|
}
|
||||||
|
|
||||||
$category->{$type} = $request->file($file)->store($dir);
|
$category->{$type} = $request->file($file)->store($dir);
|
||||||
|
|
||||||
$category->save();
|
$category->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -254,6 +257,7 @@ class CategoryRepository extends Repository
|
||||||
}
|
}
|
||||||
|
|
||||||
$category->{$type} = null;
|
$category->{$type} = null;
|
||||||
|
|
||||||
$category->save();
|
$category->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -420,8 +420,7 @@ class Cart
|
||||||
&& (
|
&& (
|
||||||
$user->email
|
$user->email
|
||||||
&& $user->first_name
|
&& $user->first_name
|
||||||
&&
|
&& $user->last_name
|
||||||
$user->last_name
|
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
$cart->customer_email = $user->email;
|
$cart->customer_email = $user->email;
|
||||||
|
|
|
||||||
|
|
@ -18,24 +18,6 @@ class CartItemRepository extends Repository
|
||||||
return 'Webkul\Checkout\Contracts\CartItem';
|
return 'Webkul\Checkout\Contracts\CartItem';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array $data
|
|
||||||
* @param $id
|
|
||||||
* @param string $attribute
|
|
||||||
*
|
|
||||||
* @return \Webkul\Checkout\Contracts\CartItem|null
|
|
||||||
*/
|
|
||||||
public function update(array $data, $id, $attribute = "id"): ?CartItem
|
|
||||||
{
|
|
||||||
$item = $this->find($id);
|
|
||||||
|
|
||||||
if ($item) {
|
|
||||||
$item->update($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $item;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $cartItemId
|
* @param int $cartItemId
|
||||||
* @return int
|
* @return int
|
||||||
|
|
|
||||||
|
|
@ -17,32 +17,6 @@ class CartRepository extends Repository
|
||||||
return 'Webkul\Checkout\Contracts\Cart';
|
return 'Webkul\Checkout\Contracts\Cart';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array $data
|
|
||||||
* @return \Webkul\Checkout\Contracts\Cart
|
|
||||||
*/
|
|
||||||
public function create(array $data)
|
|
||||||
{
|
|
||||||
$cart = $this->model->create($data);
|
|
||||||
|
|
||||||
return $cart;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array $data
|
|
||||||
* @param int $id
|
|
||||||
* @param string $attribute
|
|
||||||
* @return \Webkul\Checkout\Contracts\Cart
|
|
||||||
*/
|
|
||||||
public function update(array $data, $id, $attribute = "id")
|
|
||||||
{
|
|
||||||
$cart = $this->find($id);
|
|
||||||
|
|
||||||
$cart->update($data);
|
|
||||||
|
|
||||||
return $cart;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to detach associations. Use this only with guest cart only.
|
* Method to detach associations. Use this only with guest cart only.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,10 @@ trait CartTools
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $wishlistItem->additional) {
|
if (! $wishlistItem->additional) {
|
||||||
$wishlistItem->additional = ['product_id' => $wishlistItem->product_id, 'quantity' => 1];
|
$wishlistItem->additional = [
|
||||||
|
'product_id' => $wishlistItem->product_id,
|
||||||
|
'quantity' => 1,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
request()->merge($wishlistItem->additional);
|
request()->merge($wishlistItem->additional);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ trait CartValidators
|
||||||
|
|
||||||
$count = $cart->all_items()->where('product_id', $product->id)->count();
|
$count = $cart->all_items()->where('product_id', $product->id)->count();
|
||||||
|
|
||||||
return $count > 0 ? true : false;
|
return $count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,11 +37,9 @@ trait CartValidators
|
||||||
*/
|
*/
|
||||||
public function hasError(): bool
|
public function hasError(): bool
|
||||||
{
|
{
|
||||||
if (! $this->getCart()) {
|
if (
|
||||||
return true;
|
! $this->getCart()
|
||||||
}
|
|| ! $this->isItemsHaveSufficientQuantity()) {
|
||||||
|
|
||||||
if (! $this->isItemsHaveSufficientQuantity()) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,11 +64,15 @@ class BookingCron extends Command
|
||||||
ProductFlat::query()->where('product_id', $expEvent->product_id)
|
ProductFlat::query()->where('product_id', $expEvent->product_id)
|
||||||
->update(['status' => 0]);
|
->update(['status' => 0]);
|
||||||
|
|
||||||
Log::info('BookingCron: deactivated expired event', ['booking_product_id' => $expEvent->id, 'product_id' => $expEvent->product_id]);
|
Log::info('BookingCron: deactivated expired event', [
|
||||||
|
'booking_product_id' => $expEvent->id,
|
||||||
|
'product_id' => $expEvent->product_id,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
$this->info('All expired events have been deactivated');
|
$this->info('All expired events have been deactivated');
|
||||||
} else {
|
} else {
|
||||||
Log::info('BookingCron: Did not find any expired events to be deactivated');
|
Log::info('BookingCron: Did not find any expired events to be deactivated');
|
||||||
|
|
||||||
$this->info('Did not find any expired events to be deactivated');
|
$this->info('Did not find any expired events to be deactivated');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace Webkul\Core\Http\Controllers;
|
namespace Webkul\Core\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Event;
|
||||||
use Webkul\Admin\DataGrids\ExchangeRatesDataGrid;
|
use Webkul\Admin\DataGrids\ExchangeRatesDataGrid;
|
||||||
use Webkul\Core\Repositories\CurrencyRepository;
|
use Webkul\Core\Repositories\CurrencyRepository;
|
||||||
use Webkul\Core\Repositories\ExchangeRateRepository;
|
use Webkul\Core\Repositories\ExchangeRateRepository;
|
||||||
|
|
@ -68,7 +69,12 @@ class ExchangeRateController extends Controller
|
||||||
'rate' => 'required|numeric',
|
'rate' => 'required|numeric',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->exchangeRateRepository->create(request()->all());
|
|
||||||
|
Event::dispatch('core.exchange_rate.create.before');
|
||||||
|
|
||||||
|
$exchangeRate = $this->exchangeRateRepository->create(request()->all());
|
||||||
|
|
||||||
|
Event::dispatch('core.exchange_rate.create.after', $exchangeRate);
|
||||||
|
|
||||||
session()->flash('success', trans('admin::app.settings.exchange_rates.create-success'));
|
session()->flash('success', trans('admin::app.settings.exchange_rates.create-success'));
|
||||||
|
|
||||||
|
|
@ -103,7 +109,11 @@ class ExchangeRateController extends Controller
|
||||||
'rate' => 'required|numeric',
|
'rate' => 'required|numeric',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->exchangeRateRepository->update(request()->all(), $id);
|
Event::dispatch('core.exchange_rate.update.before', $id);
|
||||||
|
|
||||||
|
$exchangeRate = $this->exchangeRateRepository->update(request()->all(), $id);
|
||||||
|
|
||||||
|
Event::dispatch('core.exchange_rate.update.after', $exchangeRate);
|
||||||
|
|
||||||
session()->flash('success', trans('admin::app.settings.exchange_rates.update-success'));
|
session()->flash('success', trans('admin::app.settings.exchange_rates.update-success'));
|
||||||
|
|
||||||
|
|
@ -139,8 +149,12 @@ class ExchangeRateController extends Controller
|
||||||
$this->exchangeRateRepository->findOrFail($id);
|
$this->exchangeRateRepository->findOrFail($id);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Event::dispatch('core.exchange_rate.delete.before', $id);
|
||||||
|
|
||||||
$this->exchangeRateRepository->delete($id);
|
$this->exchangeRateRepository->delete($id);
|
||||||
|
|
||||||
|
Event::dispatch('core.exchange_rate.delete.after', $id);
|
||||||
|
|
||||||
return response()->json(['message' => trans('admin::app.settings.exchange_rates.delete-success')]);
|
return response()->json(['message' => trans('admin::app.settings.exchange_rates.delete-success')]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
report($e);
|
report($e);
|
||||||
|
|
|
||||||
|
|
@ -60,18 +60,17 @@ class SubscriptionController extends Controller
|
||||||
*/
|
*/
|
||||||
public function update($id)
|
public function update($id)
|
||||||
{
|
{
|
||||||
$data = request()->all();
|
|
||||||
|
|
||||||
$subscriber = $this->subscribersListRepository->findOrFail($id);
|
$subscriber = $this->subscribersListRepository->findOrFail($id);
|
||||||
|
|
||||||
$customer = $subscriber->customer;
|
$customer = $subscriber->customer;
|
||||||
|
|
||||||
if (! is_null($customer)) {
|
if (! is_null($customer)) {
|
||||||
$customer->subscribed_to_news_letter = $data['is_subscribed'];
|
$customer->subscribed_to_news_letter = request('is_subscribed');
|
||||||
|
|
||||||
$customer->save();
|
$customer->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $subscriber->update($data);
|
$result = $subscriber->update(request()->all());
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
session()->flash('success', trans('admin::app.customers.subscribers.update-success'));
|
session()->flash('success', trans('admin::app.customers.subscribers.update-success'));
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Webkul\Core\Repositories;
|
namespace Webkul\Core\Repositories;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Event;
|
|
||||||
use Prettus\Repository\Traits\CacheableRepository;
|
use Prettus\Repository\Traits\CacheableRepository;
|
||||||
use Webkul\Core\Eloquent\Repository;
|
use Webkul\Core\Eloquent\Repository;
|
||||||
|
|
||||||
|
|
@ -19,54 +18,4 @@ class ExchangeRateRepository extends Repository
|
||||||
{
|
{
|
||||||
return \Webkul\Core\Contracts\CurrencyExchangeRate::class;
|
return \Webkul\Core\Contracts\CurrencyExchangeRate::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create.
|
|
||||||
*
|
|
||||||
* @param array $attributes
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function create(array $attributes)
|
|
||||||
{
|
|
||||||
Event::dispatch('core.exchange_rate.create.before');
|
|
||||||
|
|
||||||
$exchangeRate = parent::create($attributes);
|
|
||||||
|
|
||||||
Event::dispatch('core.exchange_rate.create.after', $exchangeRate);
|
|
||||||
|
|
||||||
return $exchangeRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update.
|
|
||||||
*
|
|
||||||
* @param array $attributes
|
|
||||||
* @param $id
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function update(array $attributes, $id)
|
|
||||||
{
|
|
||||||
Event::dispatch('core.exchange_rate.update.before', $id);
|
|
||||||
|
|
||||||
$exchangeRate = parent::update($attributes, $id);
|
|
||||||
|
|
||||||
Event::dispatch('core.exchange_rate.update.after', $exchangeRate);
|
|
||||||
|
|
||||||
return $exchangeRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete.
|
|
||||||
*
|
|
||||||
* @param int $id
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function delete($id)
|
|
||||||
{
|
|
||||||
Event::dispatch('core.exchange_rate.delete.before', $id);
|
|
||||||
|
|
||||||
parent::delete($id);
|
|
||||||
|
|
||||||
Event::dispatch('core.exchange_rate.delete.after', $id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ class Captcha implements CaptchaContract
|
||||||
|
|
||||||
$response = $client->post($this->getSiteVerifyEndpoint(), [
|
$response = $client->post($this->getSiteVerifyEndpoint(), [
|
||||||
'query' => [
|
'query' => [
|
||||||
'secret' => $this->secretKey,
|
'secret' => $this->secretKey,
|
||||||
'response' => $response
|
'response' => $response
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
@ -160,7 +160,7 @@ class Captcha implements CaptchaContract
|
||||||
protected function getAttributes(): array
|
protected function getAttributes(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'class' => 'g-recaptcha',
|
'class' => 'g-recaptcha',
|
||||||
'data-sitekey' => $this->siteKey,
|
'data-sitekey' => $this->siteKey,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,6 @@ class WishlistController extends Controller
|
||||||
*/
|
*/
|
||||||
protected $_config;
|
protected $_config;
|
||||||
|
|
||||||
/**
|
|
||||||
* Current customer.
|
|
||||||
*
|
|
||||||
* @var \Webkul\Customer\Models\Customer
|
|
||||||
*/
|
|
||||||
protected $currentCustomer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new controller instance.
|
* Create a new controller instance.
|
||||||
*
|
*
|
||||||
|
|
@ -52,9 +45,9 @@ class WishlistController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
return view($this->_config['view'], [
|
return view($this->_config['view'], [
|
||||||
'items' => $this->wishlistRepository->getCustomerWishlist(),
|
'items' => $this->wishlistRepository->getCustomerWishlist(),
|
||||||
'isSharingEnabled' => $this->isSharingEnabled(),
|
'isSharingEnabled' => $this->isSharingEnabled(),
|
||||||
'isWishlistShared' => $customer->isWishlistShared(),
|
'isWishlistShared' => $customer->isWishlistShared(),
|
||||||
'wishlistSharedLink' => $customer->getWishlistSharedLink()
|
'wishlistSharedLink' => $customer->getWishlistSharedLink()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
@ -62,17 +55,18 @@ class WishlistController extends Controller
|
||||||
/**
|
/**
|
||||||
* Function to add item to the wishlist.
|
* Function to add item to the wishlist.
|
||||||
*
|
*
|
||||||
* @param int $itemId
|
* @param int $productId
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function add($itemId)
|
public function add($productId)
|
||||||
{
|
{
|
||||||
$customer = auth()->guard('customer')->user();
|
$customer = auth()->guard('customer')->user();
|
||||||
|
|
||||||
$product = $this->productRepository->find($itemId);
|
$product = $this->productRepository->find($productId);
|
||||||
|
|
||||||
if ( $product == null ) {
|
if (! $product) {
|
||||||
session()->flash('error', trans('customer::app.product-removed'));
|
session()->flash('error', trans('customer::app.product-removed'));
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
} elseif (! $product->status) {
|
} elseif (! $product->status) {
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
|
|
@ -80,34 +74,31 @@ class WishlistController extends Controller
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'channel_id' => core()->getCurrentChannel()->id,
|
'channel_id' => core()->getCurrentChannel()->id,
|
||||||
'product_id' => $itemId,
|
'product_id' => $productId,
|
||||||
'customer_id' => $customer->id,
|
'customer_id' => $customer->id,
|
||||||
];
|
];
|
||||||
|
|
||||||
$checked = $this->wishlistRepository->findWhere([
|
$wishlist = $this->wishlistRepository->findOneWhere($data);
|
||||||
'channel_id' => core()->getCurrentChannel()->id,
|
|
||||||
'product_id' => $itemId,
|
|
||||||
'customer_id' => $customer->id,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$product->parent
|
$product->parent
|
||||||
&& $product->parent->type !== 'configurable'
|
&& $product->parent->type !== 'configurable'
|
||||||
) {
|
) {
|
||||||
$product = $this->productRepository->find($product->parent_id);
|
$product = $this->productRepository->find($product->parent_id);
|
||||||
|
|
||||||
$data['product_id'] = $product->id;
|
$data['product_id'] = $product->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($checked->isEmpty()) {
|
if (! $wishlist) {
|
||||||
if ($this->wishlistRepository->create($data)) {
|
$wishlist = $this->wishlistRepository->create($data);
|
||||||
session()->flash('success', trans('customer::app.wishlist.success'));
|
|
||||||
|
|
||||||
return redirect()->back();
|
if ($wishlist) {
|
||||||
|
session()->flash('success', trans('customer::app.wishlist.success'));
|
||||||
} else {
|
} else {
|
||||||
session()->flash('error', trans('customer::app.wishlist.failure'));
|
session()->flash('error', trans('customer::app.wishlist.failure'));
|
||||||
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return redirect()->back();
|
||||||
} else {
|
} else {
|
||||||
$this->wishlistRepository->findOneWhere([
|
$this->wishlistRepository->findOneWhere([
|
||||||
'product_id' => $data['product_id']
|
'product_id' => $data['product_id']
|
||||||
|
|
@ -140,7 +131,7 @@ class WishlistController extends Controller
|
||||||
&& $updateCounts > 0
|
&& $updateCounts > 0
|
||||||
) {
|
) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'isWishlistShared' => $customer->isWishlistShared(),
|
'isWishlistShared' => $customer->isWishlistShared(),
|
||||||
'wishlistSharedLink' => $customer->getWishlistSharedLink()
|
'wishlistSharedLink' => $customer->getWishlistSharedLink()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
@ -257,12 +248,8 @@ class WishlistController extends Controller
|
||||||
{
|
{
|
||||||
$customer = auth()->guard('customer')->user();
|
$customer = auth()->guard('customer')->user();
|
||||||
|
|
||||||
$wishlistItems = $customer->wishlist_items;
|
foreach ($customer->wishlist_items as $wishlistItem) {
|
||||||
|
$this->wishlistRepository->delete($wishlistItem->id);
|
||||||
if ($wishlistItems->count() > 0) {
|
|
||||||
foreach ($wishlistItems as $wishlistItem) {
|
|
||||||
$this->wishlistRepository->delete($wishlistItem->id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
session()->flash('success', trans('customer::app.wishlist.remove-all-success'));
|
session()->flash('success', trans('customer::app.wishlist.remove-all-success'));
|
||||||
|
|
@ -277,8 +264,6 @@ class WishlistController extends Controller
|
||||||
*/
|
*/
|
||||||
public function isSharingEnabled(): bool
|
public function isSharingEnabled(): bool
|
||||||
{
|
{
|
||||||
return (bool) core()->getConfigData('customer.settings.wishlist.share')
|
return (bool) core()->getConfigData('customer.settings.wishlist.share');
|
||||||
? true
|
|
||||||
: false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ class VerificationEmail extends Mailable
|
||||||
->with('data', [
|
->with('data', [
|
||||||
'email' => $this->verificationData['email'],
|
'email' => $this->verificationData['email'],
|
||||||
'token' => $this->verificationData['token'],
|
'token' => $this->verificationData['token'],
|
||||||
]
|
]);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -26,7 +26,6 @@ class CustomerResetPassword extends ResetPassword
|
||||||
->view('shop::emails.customer.forget-password', [
|
->view('shop::emails.customer.forget-password', [
|
||||||
'user_name' => $notifiable->name,
|
'user_name' => $notifiable->name,
|
||||||
'token' => $this->token,
|
'token' => $this->token,
|
||||||
]
|
]);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ class CustomerUpdatePassword extends Mailable
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||||
->to($this->customer->email, $this->customer->name)
|
->to($this->customer->email, $this->customer->name)
|
||||||
->subject(trans('shop::app.mail.update-password.subject'))
|
->subject(trans('shop::app.mail.update-password.subject'))
|
||||||
->view('shop::emails.customer.update-password', ['user' => $this->customer]);
|
->view('shop::emails.customer.update-password', ['user' => $this->customer]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
namespace Webkul\Sitemap\Providers;
|
namespace Webkul\Sitemap\Providers;
|
||||||
|
|
||||||
use Konekt\Concord\BaseModuleServiceProvider;
|
use Webkul\Core\Providers\CoreModuleServiceProvider;
|
||||||
|
|
||||||
class ModuleServiceProvider extends BaseModuleServiceProvider
|
class ModuleServiceProvider extends CoreModuleServiceProvider
|
||||||
{
|
{
|
||||||
protected $models = [
|
protected $models = [
|
||||||
\Webkul\Sitemap\Models\Sitemap::class
|
\Webkul\Sitemap\Models\Sitemap::class
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue