Make laravel be website multi-languagle with old request.

I will say at first. This post is about hacking laravel but It don’t about modifiy illuminate core. For who want to use laravel. First rule that you must remember.

“If you want to extend, modify or hack laravel, Don’t modify any files in /vendor. You should do it in /app only.”

Back to main topic of this post. My project that I do at work. I receive request about how to modify Request class change url back to url that don’t have language in url.

Such as (th is Thai) change back to

My english is weak and I think it’s such a pain that descript why changing Request class is solution. What is benefit. I think people who search this page from Google should know it. All I can say is It helps project can develope faster with old environment.

View code and thinking.

In paste, I post URL class extended version for make url languagable too. We make one system that handle multi-site with multi-language and have multi-admin system.

ปล. สำหรับคนไทย ตอนแรกผมจะพิมพ์ไทยอยู่นะ แต่ปรากฎว่าใช้แรงงานกับภาษาอังกฤษไปเยอะแล้ว ดังนั้นไปเปิดดิกเอาเองครับ