I have the following code:
filters.php
Route::filter('empty_cart', function () {
if (empty(Cart::contents()) || Cart::totalItems() == 0) {
return Redirect::to('');
}
});
routes.php
Route::group(array('before' => 'csrf','before' => 'detectLang','before' => 'empty_cart'), function () {
Route::get('site/{slug}/cart', array('uses' => 'CartController@getCart'));
Route::get('site/{slug}/cart/billing', array('uses' => 'CartController@getBilling'));
Route::get('site/{slug}/login', array('uses' => 'UsersController@getLoginForm'));
});
How can I redirect the user to the "site/{$slug}"
if the cart is empty? Can I use parameters in the filter.php or how can I send the "slug" to the filter?