diff --git a/packages/Webkul/Category/src/Http/Controllers/CategoryController.php b/packages/Webkul/Category/src/Http/Controllers/CategoryController.php index 8268c2187..ba9cd3f29 100755 --- a/packages/Webkul/Category/src/Http/Controllers/CategoryController.php +++ b/packages/Webkul/Category/src/Http/Controllers/CategoryController.php @@ -137,23 +137,31 @@ class CategoryController extends Controller */ public function update(Request $request, $id) { - $locale = request()->get('locale') ?: app()->getLocale(); + try { + $locale = request()->get('locale') ?: app()->getLocale(); - $this->validate(request(), [ - $locale . '.slug' => ['required', new \Webkul\Core\Contracts\Validations\Slug, function ($attribute, $value, $fail) use ($id) { - if (! $this->category->isSlugUnique($id, $value)) { - $fail(trans('admin::app.response.already-taken', ['name' => 'Category'])); - } - }], - $locale . '.name' => 'required', - 'image.*' => 'mimes:jpeg,jpg,bmp,png' - ]); + $this->validate(request(), [ + $locale . '.slug' => ['required', new \Webkul\Core\Contracts\Validations\Slug, function ($attribute, $value, $fail) use ($id) { + if (! $this->category->isSlugUnique($id, $value)) { + $fail(trans('admin::app.response.already-taken', ['name' => 'Category'])); + } + }], + $locale . '.name' => 'required', + 'image.*' => 'mimes:jpeg,jpg,bmp,png' + ]); - $this->category->update(request()->all(), $id); + $category = $this->category->findorFail($id); - session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Category'])); + $this->category->update(request()->all(), $id); - return redirect()->route($this->_config['redirect']); + session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Category'])); + + return redirect()->route($this->_config['redirect']); + } catch(\Exception $e) { + session()->flash('error', trans($e->getMessage())); + + return redirect()->back(); + } } /** diff --git a/packages/Webkul/Paypal/src/Http/routes.php b/packages/Webkul/Paypal/src/Http/routes.php index c8f7c4549..8c0a20b6a 100755 --- a/packages/Webkul/Paypal/src/Http/routes.php +++ b/packages/Webkul/Paypal/src/Http/routes.php @@ -2,7 +2,7 @@ Route::group(['middleware' => ['web']], function () { Route::prefix('paypal/standard')->group(function () { - + Route::get('/redirect', 'Webkul\Paypal\Http\Controllers\StandardController@redirect')->name('paypal.standard.redirect'); Route::get('/success', 'Webkul\Paypal\Http\Controllers\StandardController@success')->name('paypal.standard.success');