added numbers to regex for products and categories route

This commit is contained in:
MonaHartdegen 2019-11-25 14:22:49 +01:00
parent c57c5d9b6f
commit e57cd8e552
2 changed files with 4 additions and 5 deletions

View File

@ -62,7 +62,7 @@ class ProductsCategoriesProxyController extends Controller
{
$slug = rtrim($slug, '/ ');
if (preg_match('/^([a-z-]+\/?)+$/', $slug)) {
if (preg_match('/^([a-z0-9-]+\/?)+$/', $slug)) {
if (DB::table(app(CategoryTranslation::class)->getTable())
->where('url_path', '=', $slug)
@ -84,9 +84,8 @@ class ProductsCategoriesProxyController extends Controller
return view($this->_config['product_view'], compact('product', 'customer'));
}
} else {
throw new NotFoundHttpException();
}
abort(404);
}
}

View File

@ -302,7 +302,7 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
'product_view' => 'shop::products.view',
'category_view' => 'shop::products.index'
])
->where('slug', '^([a-z-]+\/?)+$')
->where('slug', '^([a-z0-9-]+\/?)+$')
->name('shop.productOrCategory.index');
Route::fallback('Webkul\Shop\Http\Controllers\HomeController@notFound');