getName(); $routeParamsFR = Route::current()->parameters(); $routeParamsEN = $routeParamsFR; $routeParamsES = $routeParamsFR; array_walk($routeParamsFR, array($this, 'unbind'), ''); array_walk($routeParamsEN, array($this, 'unbind'), 'en'); array_walk($routeParamsES, array($this, 'unbind'), 'es'); if (preg_match('/^(en|es)/', $currentRoute)) { $currentRouteFR = preg_replace('/^(en|es)\./', '', $currentRoute, 1); $currentRouteEN = preg_replace('/^(en|es)/', 'en', $currentRoute, 1); $currentRouteES = preg_replace('/^(en|es)/', 'es', $currentRoute, 1); } else { $currentRouteFR = $currentRoute; $currentRouteEN = 'en.' . $currentRoute; $currentRouteES = 'es.' . $currentRoute; } View::share('currentRouteFR', $currentRouteFR); View::share('currentRouteEN', $currentRouteEN); View::share('currentRouteES', $currentRouteES); View::share('routeParamsFR', $routeParamsFR); View::share('routeParamsEN', $routeParamsEN); View::share('routeParamsES', $routeParamsES); return $next($request); } public function unbind(&$item, $k, $lang) { if ($k == 'gammeSlug' || $k == 'productSlug') { $item = $item->getTranslation('slug', $lang); } } }