本文整理汇总了PHP中app\Language::detect方法的典型用法代码示例。如果您正苦于以下问题:PHP Language::detect方法的具体用法?PHP Language::detect怎么用?PHP Language::detect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Language
的用法示例。
在下文中一共展示了Language::detect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
// Database is now available.
// Replace previous binding with an actual model instance.
$this->app->singleton('language', function () {
return \App\Language::detect()->apply();
});
}
示例2: register
/**
* Register any application services.
*
* This service provider is a great spot to register your various container
* bindings with the application. As you can see, we are registering our
* "Registrar" implementation here. You can add your own bindings too!
*
* @return void
*/
public function register()
{
// Detect global language
$this->app->singleton('language', function () {
return \App\Language::detect();
});
// Load environment Specific Service Providers...
switch ($this->app->environment()) {
default:
$providers = [];
break;
case 'local':
$providers = ['Barryvdh\\Debugbar\\ServiceProvider', 'Stolz\\HtmlTidy\\ServiceProvider', 'Stolz\\SchemaSpy\\ServiceProvider'];
break;
case 'testing':
$providers = ['Stolz\\HtmlTidy\\ServiceProvider'];
break;
}
foreach ($providers as $provider) {
$this->app->register($provider);
}
}