Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing cookie ['locale'] manually to a key that not exists breaks the application [with fix] #213

Closed
bmpf opened this issue Oct 11, 2019 · 0 comments

Comments

@bmpf
Copy link

bmpf commented Oct 11, 2019

Here the example :
image
image

Quick Fix [ PHP ]:

Add to https://github.com/cretueusebiu/laravel-vue-spa/blob/master/resources/views/index.blade.php

@php
$config = [
    'appName' => config('app.name'),
    'locale' => $locale = app()->getLocale(),
    'locales' => config('app.locales'),
    'githubAuth' => config('services.github.client_id'),
];

if ( isset ( $_COOKIE['locale'] ) AND ! array_key_exists( $_COOKIE['locale'] ,  $config['locales'] ) ) {
    setcookie ( 'locale', $config['locale'], time() + ( 86400 ), "/");
}
@endphp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant