Closed Naveedali1234 closed 3 years ago
@Naveedali1234 which version of laravel are you using?
i am using laravel ^6.0
@Naveedali1234 please add this line
echo $lang->locale;
at the end of handle method in "DetectLanguage.php" file within 'Middelware' dir , before return.. and access the url again. then give me a screenshot please.
I want to know that does it get filled? I mean the lang locale
i resolved the issue in following way:
In Models/HessamPostTranslation.php we have the following method:
public function search_result_page_url() { return $this->url(); }
but the url()
method expects atleast one parameter called locale
and in url()
method i made the parameter optional and it worked as below:
public function url($loacle='') { return route("hessamcms.single", [$loacle, $this->slug]); }
yes it works, but your post URLs will be wrong. The locale is required to detect language. But I do not know why your $locale is empty. If you find why, we can easily fix it many thanks
let me send a screenshot by printing the result as you asked.
i think it's showing the locale en , please see it on top left.
yes you are right, it's showing.. let me check it in more detail
i think it's just because of the reason which i mentioned before. maybe i am wrong.
the that was a partial solution, that solves the problem but generates links without locales (for example "en", "fr"). And we need these locales No worry, I will fix it
okay thank you @vhessam
thanks you too Naveed
i can add the posts successfully but now i am facing another issue when showing all the blog posts on homepage on this url en/blog. i can see the below error:
Too few arguments to function HessamCMS\Models\HessamPostTranslation::url(), 0 passed in /var/www/html/ski_pro_web/vendor/hessam/laravel-blogger/src/Models/HessamPostTranslation.php on line 129 and exactly 1 expected (View: /var/www/html/ski_pro_web/resources/views/vendor/hessamcms/partials/index_loop.blade.php)