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',
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community