change update & delete query in controller & comment added

This commit is contained in:
rahul shukla 2019-04-08 16:48:43 +05:30
parent 28c45c9bfa
commit 4bd89950ce
36 changed files with 121 additions and 148 deletions

View File

@ -42,7 +42,7 @@ class ConfigurationController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Core\Repositories\CoreConfigRepository $coreConfig * @param \Webkul\Core\Repositories\CoreConfigRepository $coreConfig
* @return void * @return void
*/ */
public function __construct(CoreConfig $coreConfig) public function __construct(CoreConfig $coreConfig)

View File

@ -129,7 +129,7 @@ class CustomerController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$customer = $this->customer->findOneWhere(['id'=>$id]); $customer = $this->customer->findOrFail($id);
$customerGroup = $this->customerGroup->all(); $customerGroup = $this->customerGroup->all();
@ -172,7 +172,7 @@ class CustomerController extends Controller
*/ */
public function destroy($id) public function destroy($id)
{ {
$this->customer->delete($id); $this->customer->findOrFail($id)->delete();
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Customer'])); session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Customer']));

View File

@ -32,7 +32,7 @@ class CustomerGroupController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Customer\Repositories\CustomerGroupRepository as customerGroup; * @param \Webkul\Customer\Repositories\CustomerGroupRepository as customerGroup;
* @return void * @return void
*/ */
public function __construct(CustomerGroup $customerGroup) public function __construct(CustomerGroup $customerGroup)
@ -94,7 +94,7 @@ class CustomerGroupController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$group = $this->customerGroup->findOneWhere(['id'=>$id]); $group = $this->customerGroup->findOrFail($id);
return view($this->_config['view'], compact('group')); return view($this->_config['view'], compact('group'));
} }
@ -127,7 +127,7 @@ class CustomerGroupController extends Controller
*/ */
public function destroy($id) public function destroy($id)
{ {
$group = $this->customerGroup->findOneByField('id', $id); $group = $this->customerGroup->findOrFail($id);
if ($group->is_user_defined == 0) { if ($group->is_user_defined == 0) {
session()->flash('warning', trans('admin::app.customers.customers.group-default')); session()->flash('warning', trans('admin::app.customers.customers.group-default'));

View File

@ -86,10 +86,10 @@ class DashboardController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Sales\Repositories\OrderRepository $order * @param \Webkul\Sales\Repositories\OrderRepository $order
* @param Webkul\Sales\Repositories\OrderItemRepository $orderItem * @param \Webkul\Sales\Repositories\OrderItemRepository $orderItem
* @param Webkul\Customer\Repositories\CustomerRepository $customer * @param \Webkul\Customer\Repositories\CustomerRepository $customer
* @param Webkul\Product\Repositories\ProductInventoryRepository $productInventory * @param \Webkul\Product\Repositories\ProductInventoryRepository $productInventory
* @return void * @return void
*/ */
public function __construct( public function __construct(

View File

@ -44,17 +44,17 @@ class ExportController extends Controller
$proceed = false; $proceed = false;
foreach($this->exportableGrids as $exportableGrid) { foreach ($this->exportableGrids as $exportableGrid) {
if(last($gridName) == $exportableGrid) { if (last($gridName) == $exportableGrid) {
$proceed = true; $proceed = true;
} }
} }
if(! $proceed) { if (! $proceed) {
return redirect()->back(); return redirect()->back();
} }
$gridInstance = new $path;
$gridInstance = new $path;
$records = $gridInstance->export(); $records = $gridInstance->export();
if (count($records) == 0) { if (count($records) == 0) {
@ -66,14 +66,13 @@ 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');
} }
if ($format == 'xls') { if ($format == 'xls') {
return Excel::download(new DataGridExport($records), last($gridName).'.xlsx'); return Excel::download(new DataGridExport($records), last($gridName).'.xlsx');
} }
session()->flash('warning', trans('admin::app.export.illegal-format')); session()->flash('warning', trans('admin::app.export.illegal-format'));
return redirect()->back(); return redirect()->back();
} }
} }

View File

@ -41,8 +41,8 @@ class InvoiceController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Sales\Repositories\OrderRepository $order * @param \Webkul\Sales\Repositories\OrderRepository $order
* @param Webkul\Sales\Repositories\InvoiceRepository $invoice * @param \Webkul\Sales\Repositories\InvoiceRepository $invoice
* @return void * @return void
*/ */
public function __construct(Invoice $invoice, Order $order) public function __construct(Invoice $invoice, Order $order)
@ -75,7 +75,7 @@ class InvoiceController extends Controller
*/ */
public function create($orderId) public function create($orderId)
{ {
$order = $this->order->find($orderId); $order = $this->order->findOrFail($orderId);
return view($this->_config['view'], compact('order')); return view($this->_config['view'], compact('order'));
} }
@ -89,7 +89,7 @@ class InvoiceController extends Controller
*/ */
public function store(Request $request, $orderId) public function store(Request $request, $orderId)
{ {
$order = $this->order->find($orderId); $order = $this->order->findOrFail($orderId);
if (! $order->canInvoice()) { if (! $order->canInvoice()) {
session()->flash('error', trans('admin::app.sales.invoices.creation-error')); session()->flash('error', trans('admin::app.sales.invoices.creation-error'));
@ -132,7 +132,7 @@ class InvoiceController extends Controller
*/ */
public function view($id) public function view($id)
{ {
$invoice = $this->invoice->find($id); $invoice = $this->invoice->findOrFail($id);
return view($this->_config['view'], compact('invoice')); return view($this->_config['view'], compact('invoice'));
} }
@ -145,7 +145,7 @@ class InvoiceController extends Controller
*/ */
public function print($id) public function print($id)
{ {
$invoice = $this->invoice->find($id); $invoice = $this->invoice->findOrFail($id);
$pdf = PDF::loadView('admin::sales.invoices.pdf', compact('invoice'))->setPaper('a4'); $pdf = PDF::loadView('admin::sales.invoices.pdf', compact('invoice'))->setPaper('a4');

View File

@ -32,7 +32,7 @@ class OrderController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Sales\Repositories\OrderRepository $order * @param \Webkul\Sales\Repositories\OrderRepository $order
* @return void * @return void
*/ */
public function __construct(Order $order) public function __construct(Order $order)
@ -63,7 +63,7 @@ class OrderController extends Controller
*/ */
public function view($id) public function view($id)
{ {
$order = $this->order->find($id); $order = $this->order->findOrFail($id);
return view($this->_config['view'], compact('order')); return view($this->_config['view'], compact('order'));
} }

View File

@ -48,9 +48,9 @@ class ShipmentController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Sales\Repositories\ShipmentRepository $shipment * @param \Webkul\Sales\Repositories\ShipmentRepository $shipment
* @param Webkul\Sales\Repositories\OrderRepository $order * @param \Webkul\Sales\Repositories\OrderRepository $order
* @param Webkul\Sales\Repositories\OrderitemRepository $orderItem * @param \Webkul\Sales\Repositories\OrderitemRepository $orderItem
* @return void * @return void
*/ */
public function __construct( public function __construct(
@ -89,7 +89,7 @@ class ShipmentController extends Controller
*/ */
public function create($orderId) public function create($orderId)
{ {
$order = $this->order->find($orderId); $order = $this->order->findOrFail($orderId);
if (! $order->channel || !$order->canShip()) { if (! $order->channel || !$order->canShip()) {
session()->flash('error', trans('admin::app.sales.shipments.creation-error')); session()->flash('error', trans('admin::app.sales.shipments.creation-error'));
@ -109,7 +109,7 @@ class ShipmentController extends Controller
*/ */
public function store(Request $request, $orderId) public function store(Request $request, $orderId)
{ {
$order = $this->order->find($orderId); $order = $this->order->findOrFail($orderId);
if (! $order->canShip()) { if (! $order->canShip()) {
session()->flash('error', trans('admin::app.sales.shipments.order-error')); session()->flash('error', trans('admin::app.sales.shipments.order-error'));
@ -182,7 +182,7 @@ class ShipmentController extends Controller
*/ */
public function view($id) public function view($id)
{ {
$shipment = $this->shipment->find($id); $shipment = $this->shipment->findOrFail($id);
return view($this->_config['view'], compact('shipment')); return view($this->_config['view'], compact('shipment'));
} }

View File

@ -32,7 +32,7 @@ class AttributeController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Attribute\Repositories\AttributeRepository $attribute * @param \Webkul\Attribute\Repositories\AttributeRepository $attribute
* @return void * @return void
*/ */
public function __construct(Attribute $attribute) public function __construct(Attribute $attribute)
@ -94,7 +94,7 @@ class AttributeController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$attribute = $this->attribute->find($id); $attribute = $this->attribute->findOrFail($id);
return view($this->_config['view'], compact('attribute')); return view($this->_config['view'], compact('attribute'));
} }
@ -131,7 +131,7 @@ class AttributeController extends Controller
{ {
$attribute = $this->attribute->findOrFail($id); $attribute = $this->attribute->findOrFail($id);
if(!$attribute->is_user_defined) { if (!$attribute->is_user_defined) {
session()->flash('error', trans('admin::app.response.user-define-error', ['name' => 'Attribute'])); session()->flash('error', trans('admin::app.response.user-define-error', ['name' => 'Attribute']));
} else { } else {
try { try {

View File

@ -33,7 +33,7 @@ class AttributeFamilyController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Attribute\Repositories\AttributeFamilyRepository $attributeFamily * @param \Webkul\Attribute\Repositories\AttributeFamilyRepository $attributeFamily
* @return void * @return void
*/ */
public function __construct(AttributeFamily $attributeFamily) public function __construct(AttributeFamily $attributeFamily)
@ -96,7 +96,7 @@ class AttributeFamilyController extends Controller
*/ */
public function edit(Attribute $attribute, $id) public function edit(Attribute $attribute, $id)
{ {
$attributeFamily = $this->attributeFamily->with(['attribute_groups.custom_attributes'])->find($id, ['*']); $attributeFamily = $this->attributeFamily->with(['attribute_groups.custom_attributes'])->findOrFail($id, ['*']);
$custom_attributes = $attribute->all(['id', 'code', 'admin_name', 'type']); $custom_attributes = $attribute->all(['id', 'code', 'admin_name', 'type']);
@ -132,7 +132,7 @@ class AttributeFamilyController extends Controller
*/ */
public function destroy($id) public function destroy($id)
{ {
$attributeFamily = $this->attributeFamily->find($id); $attributeFamily = $this->attributeFamily->findOrFail($id);
if ($this->attributeFamily->count() == 1) { if ($this->attributeFamily->count() == 1) {
session()->flash('error', trans('admin::app.response.last-delete-error', ['name' => 'Family'])); session()->flash('error', trans('admin::app.response.last-delete-error', ['name' => 'Family']));

View File

@ -33,7 +33,7 @@ class CategoryController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Category\Repositories\CategoryRepository $category * @param \Webkul\Category\Repositories\CategoryRepository $category
* @return void * @return void
*/ */
public function __construct(Category $category) public function __construct(Category $category)
@ -108,7 +108,7 @@ class CategoryController extends Controller
{ {
$categories = $this->category->getCategoryTree($id); $categories = $this->category->getCategoryTree($id);
$category = $this->category->find($id); $category = $this->category->findOrFail($id);
return view($this->_config['view'], compact('category', 'categories')); return view($this->_config['view'], compact('category', 'categories'));
} }
@ -151,7 +151,9 @@ class CategoryController extends Controller
{ {
Event::fire('catalog.category.delete.before', $id); Event::fire('catalog.category.delete.before', $id);
if(strtolower($this->category->find($id)->name) == "root") { $category = $this->category->findOrFail($id);
if (strtolower($this->category->find($id)->name) == "root") {
session()->flash('warning', trans('admin::app.response.delete-category-root', ['name' => 'Category'])); session()->flash('warning', trans('admin::app.response.delete-category-root', ['name' => 'Category']));
} else { } else {
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Category'])); session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Category']));

View File

@ -32,7 +32,7 @@ class ChannelController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Core\Repositories\ChannelRepository $channel * @param \Webkul\Core\Repositories\ChannelRepository $channel
* @return void * @return void
*/ */
public function __construct(Channel $channel) public function __construct(Channel $channel)
@ -100,7 +100,7 @@ class ChannelController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$channel = $this->channel->with(['locales', 'currencies'])->find($id); $channel = $this->channel->with(['locales', 'currencies'])->findOrFail($id);
return view($this->_config['view'], compact('channel')); return view($this->_config['view'], compact('channel'));
} }
@ -146,7 +146,7 @@ class ChannelController extends Controller
*/ */
public function destroy($id) public function destroy($id)
{ {
$channel = $this->channel->find($id); $channel = $this->channel->findOrFail($id);
if ($channel->code == config('app.channel')) { if ($channel->code == config('app.channel')) {
session()->flash('error', trans('admin::app.response.cannot-delete-default', ['name' => 'Channel'])); session()->flash('error', trans('admin::app.response.cannot-delete-default', ['name' => 'Channel']));
@ -154,7 +154,7 @@ class ChannelController extends Controller
Event::fire('core.channel.delete.before', $id); Event::fire('core.channel.delete.before', $id);
try { try {
$this->channel->delete($id); $this->channel->findOrFail($id)->delete();
} catch(\Exception $e) { } catch(\Exception $e) {
session()->flash('warning', trans($e->getMessage())); session()->flash('warning', trans($e->getMessage()));
} }

View File

@ -39,7 +39,7 @@ class CountryStateController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Core\Repositories\CountryRepository $country * @param \Webkul\Core\Repositories\CountryRepository $country
* @return void * @return void
*/ */
public function __construct(Country $country, State $state) public function __construct(Country $country, State $state)

View File

@ -32,7 +32,7 @@ class CurrencyController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Core\Repositories\CurrencyRepository $currency * @param \Webkul\Core\Repositories\CurrencyRepository $currency
* @return void * @return void
*/ */
public function __construct(Currency $currency) public function __construct(Currency $currency)
@ -94,7 +94,7 @@ class CurrencyController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$currency = $this->currency->find($id); $currency = $this->currency->findOrFail($id);
return view($this->_config['view'], compact('currency')); return view($this->_config['view'], compact('currency'));
} }
@ -135,11 +135,11 @@ class CurrencyController extends Controller
try { try {
Event::fire('core.currency.delete.before', $id); Event::fire('core.currency.delete.before', $id);
$result = $this->currency->delete($id); $result = $this->currency->findOrFail($id)->delete();
Event::fire('core.currency.delete.after', $id); Event::fire('core.currency.delete.after', $id);
if($result) if ($result)
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Currency'])); session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Currency']));
else else
session()->flash('error', trans('admin::app.response.last-delete-error', ['name' => 'Currency'])); session()->flash('error', trans('admin::app.response.last-delete-error', ['name' => 'Currency']));

View File

@ -40,8 +40,8 @@ class ExchangeRateController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Core\Repositories\ExchangeRateRepository $exchangeRate * @param \Webkul\Core\Repositories\ExchangeRateRepository $exchangeRate
* @param Webkul\Core\Repositories\CurrencyRepository $currency * @param \Webkul\Core\Repositories\CurrencyRepository $currency
* @return void * @return void
*/ */
public function __construct(ExchangeRate $exchangeRate, Currency $currency) public function __construct(ExchangeRate $exchangeRate, Currency $currency)
@ -109,7 +109,7 @@ class ExchangeRateController extends Controller
{ {
$currencies = $this->currency->all(); $currencies = $this->currency->all();
$exchangeRate = $this->exchangeRate->find($id); $exchangeRate = $this->exchangeRate->findOrFail($id);
return view($this->_config['view'], compact('currencies', 'exchangeRate')); return view($this->_config['view'], compact('currencies', 'exchangeRate'));
} }
@ -147,12 +147,12 @@ class ExchangeRateController extends Controller
*/ */
public function destroy($id) public function destroy($id)
{ {
if($this->exchangeRate->count() == 1) { if ($this->exchangeRate->count() == 1) {
session()->flash('error', trans('admin::app.response.last-delete-error', ['name' => 'Exchange rate'])); session()->flash('error', trans('admin::app.response.last-delete-error', ['name' => 'Exchange rate']));
} else { } else {
Event::fire('core.exchange_rate.delete.before', $id); Event::fire('core.exchange_rate.delete.before', $id);
$this->exchangeRate->delete($id); $this->exchangeRate->findOrFail($id)->delete();
Event::fire('core.exchange_rate.delete.after', $id); Event::fire('core.exchange_rate.delete.after', $id);

View File

@ -32,7 +32,7 @@ class LocaleController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Core\Repositories\LocaleRepository $locale * @param \Webkul\Core\Repositories\LocaleRepository $locale
* @return void * @return void
*/ */
public function __construct(Locale $locale) public function __construct(Locale $locale)
@ -94,7 +94,7 @@ class LocaleController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$locale = $this->locale->find($id); $locale = $this->locale->findOrFail($id);
return view($this->_config['view'], compact('locale')); return view($this->_config['view'], compact('locale'));
} }
@ -132,12 +132,12 @@ class LocaleController extends Controller
*/ */
public function destroy($id) public function destroy($id)
{ {
if($this->locale->count() == 1) { if ($this->locale->count() == 1) {
session()->flash('error', trans('admin::app.response.last-delete-error', ['name' => 'Locale'])); session()->flash('error', trans('admin::app.response.last-delete-error', ['name' => 'Locale']));
} else { } else {
Event::fire('core.locale.delete.before', $id); Event::fire('core.locale.delete.before', $id);
$this->locale->delete($id); $this->locale->findOrFail($id)->delete();
Event::fire('core.locale.delete.after', $id); Event::fire('core.locale.delete.after', $id);

View File

@ -35,7 +35,7 @@ class SliderController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Core\Repositories\SliderRepository $slider * @param \Webkul\Core\Repositories\SliderRepository $slider
* @return void * @return void
*/ */
public function __construct(Slider $slider) public function __construct(Slider $slider)
@ -97,7 +97,7 @@ class SliderController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$slider = $this->slider->find($id); $slider = $this->slider->findOrFail($id);
return view($this->_config['view'])->with('slider', $slider); return view($this->_config['view'])->with('slider', $slider);
} }
@ -136,7 +136,7 @@ class SliderController extends Controller
if ($this->slider->findWhere(['channel_id' => core()->getCurrentChannel()->id])->count() == 1) { if ($this->slider->findWhere(['channel_id' => core()->getCurrentChannel()->id])->count() == 1) {
session()->flash('warning', trans('admin::app.settings.sliders.delete-success')); session()->flash('warning', trans('admin::app.settings.sliders.delete-success'));
} else { } else {
$this->slider->destroy($id); $this->slider->findOrFail($id)->delete();
session()->flash('success', trans('admin::app.settings.sliders.delete-fail')); session()->flash('success', trans('admin::app.settings.sliders.delete-fail'));
} }

View File

@ -52,7 +52,7 @@ class SubscriptionController extends Controller
* @return mixed * @return mixed
*/ */
public function edit($id) { public function edit($id) {
$subscriber = $this->subscribers->findOneByField('id', $id); $subscriber = $this->subscribers->findOrFail($id);
return view($this->_config['view'])->with('subscriber', $subscriber); return view($this->_config['view'])->with('subscriber', $subscriber);
} }
@ -67,7 +67,7 @@ class SubscriptionController extends Controller
public function update($id) { public function update($id) {
$data = request()->all(); $data = request()->all();
$subscriber = $this->subscribers->findOneByField('id', $id); $subscriber = $this->subscribers->findOrFail($id);
$result = $subscriber->update($data); $result = $subscriber->update($data);

View File

@ -89,7 +89,7 @@ class AddressController extends Controller
$data['default_address'] = 1; $data['default_address'] = 1;
} }
if($this->address->create($data)) { if ($this->address->create($data)) {
session()->flash('success', trans('shop::app.customer.account.address.create.success')); session()->flash('success', trans('shop::app.customer.account.address.create.success'));
return redirect()->route($this->_config['redirect']); return redirect()->route($this->_config['redirect']);

View File

@ -42,8 +42,8 @@ class CustomerController extends Controller
/** /**
* Create a new Repository instance. * Create a new Repository instance.
* *
* @param Webkul\Customer\Repositories\CustomerRepository $customer * @param \Webkul\Customer\Repositories\CustomerRepository $customer
* @param Webkul\Product\Repositories\ProductReviewRepository $productReview * @param \Webkul\Product\Repositories\ProductReviewRepository $productReview
* @return void * @return void
*/ */
public function __construct( public function __construct(

View File

@ -42,8 +42,8 @@ class OrderController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Order\Repositories\OrderRepository $order * @param \Webkul\Order\Repositories\OrderRepository $order
* @param Webkul\Order\Repositories\InvoiceRepository $invoice * @param \Webkul\Order\Repositories\InvoiceRepository $invoice
* @return void * @return void
*/ */
public function __construct( public function __construct(

View File

@ -32,7 +32,7 @@ class InventorySourceController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Inventory\Repositories\InventorySourceRepository $inventorySource * @param \Webkul\Inventory\Repositories\InventorySourceRepository $inventorySource
* @return void * @return void
*/ */
public function __construct(InventorySource $inventorySource) public function __construct(InventorySource $inventorySource)
@ -105,7 +105,7 @@ class InventorySourceController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$inventorySource = $this->inventorySource->find($id); $inventorySource = $this->inventorySource->findOrFail($id);
return view($this->_config['view'], compact('inventorySource')); return view($this->_config['view'], compact('inventorySource'));
} }
@ -155,12 +155,12 @@ class InventorySourceController extends Controller
*/ */
public function destroy($id) public function destroy($id)
{ {
if($this->inventorySource->count() == 1) { if ($this->inventorySource->count() == 1) {
session()->flash('error', trans('admin::app.response.last-delete-error', ['name' => 'Inventory source'])); session()->flash('error', trans('admin::app.response.last-delete-error', ['name' => 'Inventory source']));
} else { } else {
Event::fire('inventory.inventory_source.delete.before', $id); Event::fire('inventory.inventory_source.delete.before', $id);
$this->inventorySource->delete($id); $this->inventorySource->findOrFail($id)->delete();
Event::fire('inventory.inventory_source.delete.after', $id); Event::fire('inventory.inventory_source.delete.after', $id);

View File

@ -31,7 +31,7 @@ class StandardController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Attribute\Repositories\OrderRepository $orderRepository * @param \Webkul\Attribute\Repositories\OrderRepository $orderRepository
* @return void * @return void
*/ */
public function __construct( public function __construct(

View File

@ -17,6 +17,10 @@ class AlterProductReviewsTable extends Migration
$table->string('name')->default(''); $table->string('name')->default('');
$table->dropForeign('product_reviews_customer_id_foreign'); $table->dropForeign('product_reviews_customer_id_foreign');
}); });
Schema::table('product_reviews', function (Blueprint $table) {
$table->integer('customer_id')->nullable()->change();
});
} }
/** /**

View File

@ -1,32 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AlterCustomerIdInProductReviewsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('product_reviews', function (Blueprint $table) {
$table->integer('customer_id')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('product_reviews', function (Blueprint $table) {
//
});
}
}

View File

@ -69,10 +69,10 @@ class ProductController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Attribute\Repositories\AttributeFamilyRepository $attributeFamily * @param \Webkul\Attribute\Repositories\AttributeFamilyRepository $attributeFamily
* @param Webkul\Category\Repositories\CategoryRepository $category * @param \Webkul\Category\Repositories\CategoryRepository $category
* @param Webkul\Inventory\Repositories\InventorySourceRepository $inventorySource * @param \Webkul\Inventory\Repositories\InventorySourceRepository $inventorySource
* @param Webkul\Product\Repositories\ProductRepository $product * @param \Webkul\Product\Repositories\ProductRepository $product
* @return void * @return void
*/ */
public function __construct( public function __construct(
@ -167,7 +167,7 @@ class ProductController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$product = $this->product->with(['variants'])->find($id); $product = $this->product->with(['variants'])->findOrFail($id);
$categories = $this->category->getCategoryTree(); $categories = $this->category->getCategoryTree();
@ -202,7 +202,7 @@ class ProductController extends Controller
*/ */
public function destroy($id) public function destroy($id)
{ {
$this->product->delete($id); $this->product->findOrFail($id)->delete();
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Product'])); session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Product']));
@ -221,7 +221,7 @@ class ProductController extends Controller
foreach ($productIds as $productId) { foreach ($productIds as $productId) {
$product = $this->product->find($productId); $product = $this->product->find($productId);
if(isset($product)) { if (isset($product)) {
$this->product->delete($productId); $this->product->delete($productId);
} }
} }

View File

@ -41,8 +41,8 @@ class ReviewController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Product\Repositories\ProductRepository $product * @param \Webkul\Product\Repositories\ProductRepository $product
* @param Webkul\Product\Repositories\ProductReviewRepository $productReview * @param \Webkul\Product\Repositories\ProductReviewRepository $productReview
* @return void * @return void
*/ */
public function __construct(Product $product, ProductReview $productReview) public function __construct(Product $product, ProductReview $productReview)
@ -72,7 +72,7 @@ class ReviewController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$review = $this->productReview->find($id); $review = $this->productReview->findOrFail($id);
return view($this->_config['view'],compact('review')); return view($this->_config['view'],compact('review'));
} }
@ -107,7 +107,7 @@ class ReviewController extends Controller
{ {
Event::fire('customer.review.delete.before', $id); Event::fire('customer.review.delete.before', $id);
$this->productReview->delete($id); $this->productReview->findOrFail($id)->delete();
Event::fire('customer.review.delete.after', $id); Event::fire('customer.review.delete.after', $id);

View File

@ -42,8 +42,8 @@ class CategoryController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Category\Repositories\CategoryRepository $category * @param \Webkul\Category\Repositories\CategoryRepository $category
* @param Webkul\Product\Repositories\ProductRepository $product * @param \Webkul\Product\Repositories\ProductRepository $product
* @return void * @return void
*/ */
public function __construct(Category $category, Product $product) public function __construct(Category $category, Product $product)

View File

@ -37,7 +37,7 @@ class OnepageController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Attribute\Repositories\OrderRepository $orderRepository * @param \Webkul\Attribute\Repositories\OrderRepository $orderRepository
* @return void * @return void
*/ */
public function __construct(OrderRepository $orderRepository) public function __construct(OrderRepository $orderRepository)

View File

@ -32,7 +32,7 @@ class ProductController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Product\Repositories\ProductRepository $product * @param \Webkul\Product\Repositories\ProductRepository $product
* @return void * @return void
*/ */
public function __construct( Product $product) public function __construct( Product $product)

View File

@ -40,8 +40,8 @@ class ReviewController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Product\Repositories\ProductRepository $product * @param \Webkul\Product\Repositories\ProductRepository $product
* @param Webkul\Product\Repositories\ProductReviewRepository $productReview * @param \Webkul\Product\Repositories\ProductReviewRepository $productReview
* @return void * @return void
*/ */
public function __construct(Product $product, ProductReview $productReview) public function __construct(Product $product, ProductReview $productReview)
@ -123,7 +123,7 @@ class ReviewController extends Controller
if ($reviews->count() > 0) { if ($reviews->count() > 0) {
foreach ($reviews as $review) { foreach ($reviews as $review) {
if($review->id == $id) { if ($review->id == $id) {
$this->productReview->delete($id); $this->productReview->delete($id);
session()->flash('success', trans('shop::app.response.delete-success', ['name' => 'Product Review'])); session()->flash('success', trans('shop::app.response.delete-success', ['name' => 'Product Review']));

View File

@ -49,9 +49,9 @@ class TaxCategoryController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Tax\Repositories\TaxCategoryRepository $taxCategory * @param \Webkul\Tax\Repositories\TaxCategoryRepository $taxCategory
* @param Webkul\Tax\Repositories\TaxRateRepository $taxRate * @param \Webkul\Tax\Repositories\TaxRateRepository $taxRate
* @param Webkul\Tax\Repositories\TaxMapRepository $taxMap * @param \Webkul\Tax\Repositories\TaxMapRepository $taxMap
* @return void * @return void
*/ */
public function __construct( public function __construct(
@ -176,7 +176,7 @@ class TaxCategoryController extends Controller
try { try {
Event::fire('tax.tax_category.delete.before', $id); Event::fire('tax.tax_category.delete.before', $id);
$this->taxCategory->delete($id); $this->taxCategory->findOrFail($id)->delete();
Event::fire('tax.tax_category.delete.after', $id); Event::fire('tax.tax_category.delete.after', $id);
} catch(Exception $e) { } catch(Exception $e) {

View File

@ -56,10 +56,10 @@ class TaxController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Core\Repositories\ChannelRepository $channel * @param \Webkul\Core\Repositories\ChannelRepository $channel
* @param Webkul\Tax\Repositories\TaxCategoryRepository $taxCategory * @param \Webkul\Tax\Repositories\TaxCategoryRepository $taxCategory
* @param Webkul\Tax\Repositories\TaxRateRepository $taxRate * @param \Webkul\Tax\Repositories\TaxRateRepository $taxRate
* @param Webkul\Tax\Repositories\TaxMapRepository $taxMap * @param \Webkul\Tax\Repositories\TaxMapRepository $taxMap
* @return void * @return void
*/ */
public function __construct(Channel $channel, TaxCategory $taxCategory, TaxRate $taxRate, TaxMap $taxMap) public function __construct(Channel $channel, TaxCategory $taxCategory, TaxRate $taxRate, TaxMap $taxMap)

View File

@ -36,7 +36,7 @@ class TaxRateController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\Tax\Repositories\TaxRateRepository $taxRate * @param \Webkul\Tax\Repositories\TaxRateRepository $taxRate
* @return void * @return void
*/ */
public function __construct(TaxRate $taxRate) public function __construct(TaxRate $taxRate)
@ -114,7 +114,7 @@ class TaxRateController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$taxRate = $this->taxRate->find($id); $taxRate = $this->taxRate->findOrFail($id);
return view($this->_config['view'])->with('taxRate', $taxRate); return view($this->_config['view'])->with('taxRate', $taxRate);
} }
@ -165,7 +165,7 @@ class TaxRateController extends Controller
// } // }
Event::fire('tax.tax_rate.delete.before', $id); Event::fire('tax.tax_rate.delete.before', $id);
$this->taxRate->delete($id); $this->taxRate->findOrFail($id)->delete();
Event::fire('tax.tax_rate.delete.after', $id); Event::fire('tax.tax_rate.delete.after', $id);

View File

@ -32,7 +32,7 @@ class RoleController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\User\Repositories\RoleRepository $role * @param \Webkul\User\Repositories\RoleRepository $role
* @return void * @return void
*/ */
public function __construct(Role $role) public function __construct(Role $role)
@ -96,7 +96,7 @@ class RoleController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$role = $this->role->find($id); $role = $this->role->findOrFail($id);
return view($this->_config['view'], compact('role')); return view($this->_config['view'], compact('role'));
} }
@ -139,7 +139,7 @@ class RoleController extends Controller
} else { } else {
Event::fire('user.role.delete.before', $id); Event::fire('user.role.delete.before', $id);
$this->role->delete($id); $this->role->findOrFail($id)->delete();
Event::fire('user.role.delete.after', $id); Event::fire('user.role.delete.after', $id);

View File

@ -42,8 +42,8 @@ class UserController extends Controller
/** /**
* Create a new controller instance. * Create a new controller instance.
* *
* @param Webkul\User\Repositories\AdminRepository $admin * @param \Webkul\User\Repositories\AdminRepository $admin
* @param Webkul\User\Repositories\RoleRepository $role * @param \Webkul\User\Repositories\RoleRepository $role
* @return void * @return void
*/ */
public function __construct(Admin $admin, Role $role) public function __construct(Admin $admin, Role $role)
@ -111,7 +111,7 @@ class UserController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$user = $this->admin->find($id); $user = $this->admin->findOrFail($id);
$roles = $this->role->all(); $roles = $this->role->all();
@ -168,7 +168,7 @@ class UserController extends Controller
return view('admin::customers.confirm-password'); return view('admin::customers.confirm-password');
} }
$this->admin->delete($id); $this->admin->findOrFail($id)->delete();
Event::fire('user.admin.delete.after', $id); Event::fire('user.admin.delete.after', $id);