diff --git a/README.md b/README.md index 7dd0b01..5c112f0 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,6 @@ [![Build Status](https://img.shields.io/github/actions/workflow/status/opgginc/codezero-laravel-localized-routes/run-tests.yml?style=flat-square&logo=github&logoColor=white&label=tests)](https://github.com/opgginc/codezero-laravel-localized-routes/actions) [![Total Downloads](https://img.shields.io/packagist/dt/opgginc/codezero-laravel-localized-routes.svg?style=flat-square)](https://packagist.org/packages/opgginc/codezero-laravel-localized-routes) -[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/R6R3UQ8V) - A convenient way to set up and use localized routes in a Laravel app. ## Important Note diff --git a/config/localized-routes.php b/config/localized-routes.php index 2dd9718..3560741 100644 --- a/config/localized-routes.php +++ b/config/localized-routes.php @@ -71,6 +71,11 @@ */ 'cookie_minutes' => 60 * 24 * 365, // 1 year + /** + * Check raw cookie with $_COOKIE due to the default encryption by Laravel. + */ + 'check_raw_cookie' => false, + /** * The detectors to use to find a matching locale. * These will be executed in the order that they are added to the array! diff --git a/src/Middleware/Detectors/CookieDetector.php b/src/Middleware/Detectors/CookieDetector.php index 043ffdd..b0b2500 100644 --- a/src/Middleware/Detectors/CookieDetector.php +++ b/src/Middleware/Detectors/CookieDetector.php @@ -15,7 +15,10 @@ class CookieDetector implements Detector public function detect() { $key = Config::get('localized-routes.cookie_name'); - - return Cookie::get($key); + if (Config::get('localized-routes.check_raw_cookie')) { + return $_COOKIE[$key] ?? null; + } else { + return Cookie::get($key); + } } }