issue #1351
This commit is contained in:
parent
7d9c785f7d
commit
6e32b928ac
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in New Issue