Merge pull request #1406 from rahulshukla-webkul/development

Development
This commit is contained in:
Jitendra Singh 2019-09-06 15:12:25 +05:30 committed by GitHub
commit 22b24c4c6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 14 deletions

View File

@ -137,23 +137,29 @@ 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);
$this->category->update(request()->all(), $id);
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Category']));
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Category']));
return redirect()->route($this->_config['redirect']);
return redirect()->route($this->_config['redirect']);
} catch(\Exception $e) {
session()->flash('error', trans($e->getMessage()));
return redirect()->back();
}
}
/**

View File

@ -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');