language localization with browser settings
This commit is contained in:
parent
8d91d0e7a8
commit
f0e84a2991
13 changed files with 231 additions and 173 deletions
35
app/Http/Middleware/LaravelLocalizationMiddlewareBase.php
Normal file
35
app/Http/Middleware/LaravelLocalizationMiddlewareBase.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
class LaravelLocalizationMiddlewareBase
|
||||
{
|
||||
/**
|
||||
* The URIs that should not be localized.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except;
|
||||
|
||||
/**
|
||||
* Determine if the request has a URI that should not be localized.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return bool
|
||||
*/
|
||||
protected function shouldIgnore($request)
|
||||
{
|
||||
$this->except = $this->except ?? config('laravellocalization.urlsIgnored', []);
|
||||
foreach ($this->except as $except) {
|
||||
if ($except !== '/') {
|
||||
$except = trim($except, '/');
|
||||
}
|
||||
|
||||
if ($request->is($except)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue