codezero-be /
browser-locale
| 1 | <?php |
||
| 2 | |||
| 3 | namespace CodeZero\BrowserLocale\Laravel; |
||
| 4 | |||
| 5 | use CodeZero\BrowserLocale\BrowserLocale; |
||
| 6 | use Illuminate\Support\ServiceProvider; |
||
| 7 | use Request; |
||
| 8 | |||
| 9 | class BrowserLocaleServiceProvider extends ServiceProvider |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Register any application services. |
||
| 13 | * |
||
| 14 | * @return void |
||
| 15 | */ |
||
| 16 | public function register() |
||
| 17 | { |
||
| 18 | $this->registerBrowserLocale(); |
||
| 19 | } |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Register BrowserLocale. |
||
| 23 | * |
||
| 24 | * @return void |
||
| 25 | */ |
||
| 26 | protected function registerBrowserLocale() |
||
| 27 | { |
||
| 28 | $this->app->bind(BrowserLocale::class, function () { |
||
| 29 | return new BrowserLocale( |
||
| 30 | Request::server('HTTP_ACCEPT_LANGUAGE') |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 31 | ); |
||
| 32 | }); |
||
| 33 | } |
||
| 34 | } |
||
| 35 |