Skip to content

Commit

Permalink
Merge pull request #116 from ARCANEDEV/patch-1
Browse files Browse the repository at this point in the history
Updating the package
  • Loading branch information
arcanedev-maroc authored Feb 11, 2018
2 parents 5f7c2ec + adba266 commit 3a56829
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
7 changes: 2 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"license": "MIT",
"require": {
"php": ">=7.0",
"arcanedev/support": "~4.1"
"arcanedev/support": "~4.2.0"
},
"require-dev": {
"phpunit/phpcov": "~4.0",
Expand All @@ -39,10 +39,7 @@
"laravel": {
"providers": [
"Arcanedev\\Localization\\LocalizationServiceProvider"
],
"aliases": {
"Localization": "Arcanedev\\Localization\\Facades\\Localization"
}
]
}
},
"suggest": {
Expand Down
2 changes: 2 additions & 0 deletions config/localization.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

'hide-default-in-url' => false,

'redirection-code' => 302,

'facade' => 'Localization',

/* -----------------------------------------------------------------
Expand Down
10 changes: 5 additions & 5 deletions src/LocalizationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public function register()
Providers\UtilitiesServiceProvider::class,
]);
$this->registerLocalization();
$this->registerAliases();
}

/**
Expand Down Expand Up @@ -78,9 +77,10 @@ private function registerLocalization()
{
$this->singleton(Contracts\Localization::class, Localization::class);

$this->alias(
$this->config()->get('localization.facade', 'Localization'),
Facades\Localization::class
);
if ($alias = $this->config()->get('localization.facade')) {
$this->alias($alias, Facades\Localization::class);

$this->registerAliases();
}
}
}
8 changes: 4 additions & 4 deletions src/Middleware/Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ protected function getLocalizedRedirect($locale)
/**
* Make a redirect response.
*
* @param string $url
* @param int $code
* @param string $url
* @param int|null $code
*
* @return \Illuminate\Http\RedirectResponse
*/
protected function makeRedirectResponse($url, $code = 302)
protected function makeRedirectResponse($url, $code = null)
{
return new RedirectResponse($url, $code, ['Vary' => 'Accept-Language']);
return new RedirectResponse($url, $code ?? config('localization.redirection-code', 302), ['Vary' => 'Accept-Language']);
}
}

0 comments on commit 3a56829

Please sign in to comment.