GrafiteInc / CMS

Decoupled CMS for any Laravel app, gain control of: pages, blogs, galleries, events, images, custom modules and more.
https://cms.grafite.ca
MIT License
495 stars 104 forks source link

Problem with showing a page #196

Closed sabinakaczor closed 5 years ago

sabinakaczor commented 5 years ago

I've created a new page through the CMS panel. While trying to visit it on Chrome browser, I get 404 error. Page is working fine on Mozilla Firefox. I've done some research and found where the error occurs. Method findPagesByURL() of PageRepository class gets into this condition:

if ($page && app()->getLocale() !== config('cms.default-language')) { $page = $this->translationRepo->findByEntityId($page->id, 'Grafite\Cms\Models\Page'); }

Page is found in database, but app()->getLocale() and config('cms.default-language') return different values. I have Polish language ('pl') set in both app.locale config and cms.default-language config, but after printing app()->getLocale() and exiting I get an weird long string starting with 'eyJpdiI6InFreU01YXZVZWU1...'. In other places of my app returned language is correct, i.e. 'pl'. But when trying to show a CMS page, the method from PageRepository is trying to get the page from TranslationRepo and returns null, even though both app locale and CMS locale are set to 'pl'. Clearing config, cache and caching config didn't help.