Laravel: Develop a multiple language / TLD site localhost
php artisan serve --port=8000
<?phpreturn [‘lang’ => ‘en’, 
‘currency’ => ‘USD’,
return Config::get(‘example.lang’) 
php artisan make:middleware CheckTLD
public function handle($request, Closure $next){ $tld = pathinfo($request->getHost(), PATHINFO_EXTENSION); Config::set(‘app.url’, $request->getHost()); if($tld == ‘es’) {  Config::set(‘example.lang’, ‘es’);
Config::set(‘example.currency’, ‘EUR’);
} return $next($request);}
protected $middlewareGroups = [‘web’ => [\App\Http\Middleware\EncryptCookies::class,\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,\Illuminate\Session\Middleware\StartSession::class,// \Illuminate\Session\Middleware\AuthenticateSession::class,\Illuminate\View\Middleware\ShareErrorsFromSession::class,\App\Http\Middleware\VerifyCsrfToken::class,\Illuminate\Routing\Middleware\SubstituteBindings::class,\App\Http\Middleware\CheckTLD::class,],‘api’ => [‘throttle:60,1’,\Illuminate\Routing\Middleware\SubstituteBindings::class,],];
{{ Config(‘example.lang’) }}
{{ Config(‘example.currency’) }}
{{ Config(‘app.url’) }}




Hello, Nice to meet you!

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Send Browser Push Notification from Wordpress

How To Calculate The CO2 Emissions Of The Petroleum Industry Using An API

Things every software engineer should know.

Build a Configurable Chain of Responsibility in Go

Chain on a fence

We can’t just celebrate our official launch.

Kotlin Programming Language: Everything You Need to Know

A Quick Guide to Organize Your Citation Using Zotero

How I run my Ghost blog with nginx and MariaDB on Docker

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kasper Kloster

Kasper Kloster

Hello, Nice to meet you!

More from Medium

Add Laravel Tinker to PHPStorm

Why Laravel Is the Best PHP Framework — 10 Reasons to go with it!

Removing all Vue dependencies from Laravel in 4 steps

How to implement github login in laravel * DevRohit Think simplified