mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 17:53:16 +00:00
Add Localization Middleware
This commit is contained in:
parent
ef10c24d16
commit
32ef92b917
1 changed files with 23 additions and 0 deletions
23
app/Http/Middleware/Localization.php
Normal file
23
app/Http/Middleware/Localization.php
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure, Session;
|
||||||
|
|
||||||
|
class Localization
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure $next
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle($request, Closure $next)
|
||||||
|
{
|
||||||
|
if(Session::has('locale')) {
|
||||||
|
app()->setLocale(Session::get('locale'));
|
||||||
|
}
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue