From 1357b9643330b1ed743722f2cbe474e6b7796fcc Mon Sep 17 00:00:00 2001 From: zarapico123 Date: Mon, 26 Sep 2016 09:44:54 +0200 Subject: [PATCH] event listen add $locale parameter --- .../LaravelLocalization/LaravelLocalization.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Mcamara/LaravelLocalization/LaravelLocalization.php b/src/Mcamara/LaravelLocalization/LaravelLocalization.php index 9d0f9cc..a5ac52e 100644 --- a/src/Mcamara/LaravelLocalization/LaravelLocalization.php +++ b/src/Mcamara/LaravelLocalization/LaravelLocalization.php @@ -228,7 +228,7 @@ public function getLocalizedURL( $locale = null, $url = null, $attributes = arra if ( empty( $attributes ) ) { - $attributes = $this->extractAttributes($url); + $attributes = $this->extractAttributes($url, $locale); } if ( empty( $url ) ) @@ -761,12 +761,13 @@ public function setBaseUrl( $url ) /** * Extract attributes for current url * - * @param string|null|false $url to extract attributes, if not present, the system will look for attributes in the current call + * @param bool|false|null|string $url to extract attributes, if not present, the system will look for attributes in the current call * - * @return array Array with attributes + * @param string $locale + * @return array Array with attributes * */ - protected function extractAttributes( $url = false ) + protected function extractAttributes( $url = false, $locale='' ) { if ( !empty( $url ) ) { @@ -855,7 +856,7 @@ protected function extractAttributes( $url = false ) } $attributes = $this->router->current()->parameters(); - $response = event('routes.translation', [ $attributes ]); + $response = event('routes.translation', [ $locale, $attributes ]); if ( !empty( $response ) ) {