本文整理汇总了PHP中Illuminate\Support\Facades\App::getLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP App::getLocale方法的具体用法?PHP App::getLocale怎么用?PHP App::getLocale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\App
的用法示例。
在下文中一共展示了App::getLocale方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: contact
public function contact()
{
$title = 'Contact';
$name = App::getLocale() == 'fr' ? 'name_fr' : 'name_en';
if (App::getLocale() == 'fr') {
$iams = [1 => 'Indépendant', 2 => 'Particulier', 3 => 'Organisme public'];
} else {
$iams = [1 => 'Professional client', 2 => 'Private client', 3 => 'Public body'];
}
$objects = Object::lists($name, 'id');
return view('pages.contact', compact('title', 'objects', 'iams'));
}
示例2: handle
/**
* @param $request
* @param Closure $next
* @return \Illuminate\Http\JsonResponse
*/
public function handle($request, Closure $next)
{
$localCode = strtoupper(App::getLocale());
$vrfArr = array('id', 'firstName', 'lastName', 'email', 'title', 'content');
$verify = true;
switch ($localCode) {
case "VI":
$fail = "Vui lòng điền đầy đủ thông tin và thử lại.";
break;
case "EN":
$fail = "Please enter fully information.";
break;
default:
$fail = "Please enter fully information.";
break;
}
for ($i = 0; $i < count($vrfArr); $i++) {
if ($request->input($vrfArr[$i]) == null || $request->input($vrfArr[$i]) == '') {
$verify = false;
}
}
if ($verify == false) {
return response()->json(['info' => 'Fail', 'Content' => $vrfArr], 200);
} else {
return $next($request);
}
}
示例3: getInputs
public function getInputs($inputs)
{
$inputs['datetime_ini'] = HelperRepository::date($inputs['datetime_ini'], App::getLocale());
$inputs['datetime_end'] = HelperRepository::date($inputs['datetime_end'], App::getLocale());
$inputs['cost'] = HelperRepository::money($inputs['cost'], App::getLocale());
return $inputs;
}
示例4: rootsForMenu
/**
* Get online root elements
*
* @param int $menuId
* @return object
*/
public function rootsForMenu($menuId)
{
return $this->model->whereHas('translations', function (Builder $q) {
$q->where('status', 1);
$q->where('locale', App::getLocale());
})->with('translations')->whereMenuId($menuId)->orderBy('position')->get();
}
示例5: getPaymentMethods
/**
* Return available payment methods by country and payment group
* Method parameters can be set via config
*
* @param string [Optional] $country
* @param array [Optional] $payment_groups_names
* @return array
*/
public static function getPaymentMethods($country = null, $payment_groups_names = null)
{
$payment_methods_info = WebToPay::getPaymentMethodList(intval(config('paysera.projectid')), config('paysera.currency'));
$country_code = !is_null($country) ? $country : strtolower(config('paysera.country'));
$payment_methods_info->setDefaultLanguage(App::getLocale());
$result = [];
$country_payment_methods_info = $payment_methods_info->getCountry($country_code);
$result['country_code'] = $country_payment_methods_info->getCode();
$result['country_title'] = $country_payment_methods_info->getTitle();
$payment_methods_groups_all = $country_payment_methods_info->getGroups();
if ($payment_groups_names == null) {
$payment_groups_names = config('paysera.payment_groups');
}
foreach ($payment_groups_names as $payment_groups_name) {
$payment_methods_groups[$payment_groups_name] = $payment_methods_groups_all[$payment_groups_name];
$result['payment_groups'][$payment_groups_name]['title'] = $payment_methods_groups_all[$payment_groups_name]->getTitle(App::getLocale());
foreach ($payment_methods_groups_all[$payment_groups_name]->getPaymentMethods() as $key => $method) {
$tmp = [];
$tmp['title'] = $method->getTitle(App::getLocale());
$tmp['key'] = $key;
$tmp['currency'] = $method->getBaseCurrency();
$tmp['logo_url'] = $method->getLogoUrl();
$tmp['object'] = $method;
$result['payment_groups'][$payment_groups_name]['methods'][$key] = $tmp;
}
}
return $result;
}
示例6: getLocaleOf
public function getLocaleOf($page)
{
$locale = App::getLocale();
//$data = Texts::all()->where('slug','=', $page)->where('lang','=', $locale);
$data = DB::table('texts')->where('slug', '=', $page)->where('lang', '=', $locale)->first();
return $data;
}
示例7: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$localCode = strtoupper(App::getLocale());
$commonModel = new Models\CommonModel();
switch ($localCode) {
case "VI":
$fail = "Vui lòng nhập email và thử lại.";
$fail1 = "Email của bạn quá dài, vui lòng nhập lại.";
$fail2 = "Email của bạn đã được đăng ký.";
break;
case "EN":
$fail = "Please input your email!";
$fail1 = "Your email is too long!";
$fail2 = "This email already subscribe";
break;
default:
$fail = "Please input your email!";
$fail1 = "Your email is too long!";
$fail2 = "This email already subscribe";
break;
}
if ($request->input('email') == null || $request->input('email') == '') {
return response()->json(['info' => 'Fail', 'Content' => $fail], 200);
} elseif (strlen($request->input('email')) > 50) {
return response()->json(['info' => 'Fail', 'Content' => $fail1], 200);
} else {
$exist = $commonModel->checkExistEmail($request->input('email'));
if ($exist > 0) {
return response()->json(['info' => 'Fail', 'Content' => $fail2], 200);
} else {
return $next($request);
}
}
}
示例8: __construct
public function __construct(Model $model = null, ElegantModelFieldInterface $field, $context = null, $locale = null)
{
$this->locale = $locale ?: App::getLocale();
$this->model = $model;
$this->field = $field;
$this->context = $context;
}
示例9: __construct
public function __construct($lang = null)
{
// set langcode
if (is_null($lang)) {
$lang = App::getLocale();
}
$this->langCode = $lang . '_' . strtoupper($lang);
}
示例10: allOnline
/**
* Get all online menus
* @return object
*/
public function allOnline()
{
$locale = App::getLocale();
return $this->model->whereHas('translations', function (Builder $q) use($locale) {
$q->where('locale', "{$locale}");
$q->where('status', 1);
})->with('translations')->orderBy('created_at', 'DESC')->get();
}
示例11: __get
/**
* Returns the language translation for the given key, based on the app's current
* locale setting.
*
* @param string $key
* @return mixed
*/
public function __get($key)
{
$lang = App::getLocale();
if (isset($this->translated[$lang][$key])) {
return $this->trans($lang, $key);
}
return parent::__get($key);
}
示例12: scopeLanguage
/**
* @param $query
* @param bool|false $data
*/
public function scopeLanguage($query, $data = false)
{
if ($data === true) {
$query->where('lang', App::getLocale())->orWhere('lang', '');
} else {
$query->where('lang', '=', App::getLocale());
}
}
示例13: getInputs
public function getInputs($inputs)
{
$inputs['pickup_date'] = HelperRepository::date($inputs['pickup_date'], App::getLocale());
$inputs['deliver_date'] = HelperRepository::date($inputs['deliver_date'], App::getLocale());
$inputs['fuel_cost'] = HelperRepository::money($inputs['fuel_cost'], App::getLocale());
$inputs['fuel_amount'] = HelperRepository::money($inputs['fuel_amount'], App::getLocale());
return $inputs;
}
示例14: strtoupper
function __construct()
{
$this->appid = Config::get('sweet-captcha::SWEETCAPTCHA_APP_ID');
$this->key = Config::get('sweet-captcha::SWEETCAPTCHA_KEY');
$this->secret = Config::get('sweet-captcha::SWEETCAPTCHA_SECRET');
$this->path = Config::get('sweet-captcha::SWEETCAPTCHA_PUBLIC_URL');
$this->language = strtoupper(Config::get('sweet-captcha::SWEETCAPTCHA_LANGUAGE') != '' ? Config::get('sweet-captcha::SWEETCAPTCHA_LANGUAGE') : App::getLocale());
}
示例15: handle
/**
* @param QuizWasCreated $event
*/
public function handle(QuizWasCreated $event)
{
$quiz = Quiz::find($event->quiz->id);
$title = $quiz->name;
$link = App::getLocale() . '/quiz/' . $quiz->id;
$user = User::find($event->user->id);
$username = $user->name;
$this->mailer->compose($user->email, $username, $title, $link)->send();
}