for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Tinyissue package.
*
* (c) Mohamed Alsharaf <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tinyissue\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;
/**
* Locale is a Middleware class to set the locale for the current logged in user.
* @author Mohamed Alsharaf <[email protected]>
class Locale extends MiddlewareAbstract
{
* Handle an incoming request.
* @param Request $request
* @param \Closure $next
* @return mixed
public function handle(Request $request, Closure $next)
if (!$this->auth->guest()) {
app()->setLocale($this->getLoggedUser()->language);
}
return $next($request);