Support the ongoing development of Laravel.io →
posted 9 years ago
Views
Last updated 2 years ago.
0

You have to create a middleware for that:

<?php namespace App\Http\Middleware;

use Closure;

class App {

	/**
	 * Handle an incoming request.
	 *
	 * @param  \Illuminate\Http\Request  $request
	 * @param  \Closure  $next
	 * @return mixed
	 */
	public function handle($request, Closure $next)
	{
		if(!\Session::has('locale'))
        {
           \Session::put('locale', \Config::get('app.locale'));
        }

        app()->setLocale(\Session::get('locale'));

        return $next($request);
	}

}

And in app/http/Kernel.php in $middleware array add

'App\Http\Middleware\App',
Last updated 9 years ago.
0

Thank you so much @KevinM86, it fixed the problem :)

0

Sign in to participate in this thread!

Eventy

Your banner here too?

iquad iquad Joined 28 Dec 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.