当前位置: 首页>>代码示例>>PHP>>正文


PHP Lang::has方法代码示例

本文整理汇总了PHP中Lang::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Lang::has方法的具体用法?PHP Lang::has怎么用?PHP Lang::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lang的用法示例。


在下文中一共展示了Lang::has方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: typeTitle

 public function typeTitle()
 {
     if (\Lang::has('CMS::users.user_types.' . $this->type)) {
         return trans('CMS::users.user_types.' . $this->type);
     }
     return ucwords($this->type);
 }
开发者ID:socieboy,项目名称:reactor-cms,代码行数:7,代码来源:UserPresenter.php

示例2: hasLang

 public static function hasLang($string)
 {
     if (static::isLaravel()) {
         return \Lang::has($string);
     }
     return false;
 }
开发者ID:neondigital,项目名称:forma,代码行数:7,代码来源:Helpers.php

示例3: getFailedLoginMessage

 /**
  * Get the failed login message.
  *
  * @return string
  */
 protected function getFailedLoginMessage($spec)
 {
     if ($spec == 'forCredentials') {
         return Lang::has('usersys.credentials') ? Lang::get('usersys.credentials') : 'These credentials do not match our records.';
     } elseif ($spec == 'forActivation') {
         return Lang::has('usersys.inactive') ? Lang::get('usersys.inactive') : 'Your email id is not verified.';
     }
 }
开发者ID:Tjoosten,项目名称:usersys,代码行数:13,代码来源:AuthenticationTrait.php

示例4: translateAttribute

 function translateAttribute($string)
 {
     $new = 'shapeshifter::attributes.' . $string;
     if (Lang::has($new)) {
         return ucfirst(Lang::get($new));
     }
     return ucfirst($string);
 }
开发者ID:wearejust,项目名称:shapeshifter,代码行数:8,代码来源:helpers.php

示例5: get_trans

 function get_trans($name)
 {
     if (Lang::has('all.' . $name)) {
         return trans('all.' . $name);
     } else {
         return $name;
     }
 }
开发者ID:Vatia13,项目名称:megaportal,代码行数:8,代码来源:helpers.php

示例6: show

 public function show($id)
 {
     $permissionRole = $this->roles->rol($id);
     $role = $this->roles->getModelNew();
     $nameRol = Lang::has('utils.roles.' . $role->name) ? Lang::get('utils.roles.' . $role->name) : $role->name;
     $permissions = $permissionRole->isEmpty() ? Permission::orderBy('name')->get() : Permission::whereNotIn('id', $permissionRole->lists('id'))->orderBy('name')->get();
     return View::make('back.role', compact('permissionRole', 'role', 'permissions', 'nameRol'));
 }
开发者ID:juan2ramos,项目名称:credito,代码行数:8,代码来源:RolesController.php

示例7: buildLabel

 public function buildLabel($name)
 {
     if (\Lang::has('validation.attributes.' . $name)) {
         $label = \Lang::get('validation.attributes.' . $name);
     } else {
         $label = str_replace('_', ' ', $name);
     }
     return ucfirst($label);
 }
开发者ID:jolupopa,项目名称:veain51,代码行数:9,代码来源:FieldBuilder.php

示例8: getValidationMessage

 /**
  * Get user friendly validation message.
  *
  * @return string
  */
 public static function getValidationMessage($attribute, $rule, $data = [], $type = null)
 {
     $path = $rule;
     if ($type !== null) {
         $path .= '.' . $type;
     }
     if (\Lang::has('validation.custom.' . $attribute . '.' . $path)) {
         $path = 'custom.' . $attribute . '.' . $path;
     }
     $niceName = !\Lang::has('validation.attributes.' . $attribute) ? $attribute : \Lang::get('validation.attributes.' . $attribute);
     return \Lang::get('validation.' . $path, $data + ['attribute' => $niceName]);
 }
开发者ID:phpspider,项目名称:laravalid,代码行数:17,代码来源:Helper.php

示例9: buildLabel

 public function buildLabel($name, $attributes = null)
 {
     if (isset($attributes['label'])) {
         return $attributes['label'];
     }
     if (\Lang::has('validation.attributes.' . $name)) {
         $label = \Lang::get('validation.attributes.' . $name);
     } else {
         $label = str_replace('_', ' ', $name);
     }
     return ucfirst($label);
 }
开发者ID:nhitrort90,项目名称:cms,代码行数:12,代码来源:FieldBuilder.php

示例10: getUserTypesList

function getUserTypesList()
{
    $user_types = config('cms.user_types');
    $result = [];
    foreach ($user_types as $type) {
        if (\Lang::has('CMS::core.user_types.' . $type)) {
            $result[$type] = trans('CMS::core.user_types.' . $type);
        } else {
            $result[$type] = ucwords($type);
        }
    }
    return $result;
}
开发者ID:socieboy,项目名称:reactor-cms,代码行数:13,代码来源:helpers.php

示例11: l

function l($string = NULL, $data = [], $langfile = NULL)
{
    if ($langfile == NULL) {
        $langfile = \App\Context::getContext()->controller;
    }
    if (Lang::has($langfile . '.' . $string)) {
        return Lang::get($langfile . '.' . $string, $data);
    } else {
        foreach ($data as $key => $value) {
            $string = str_replace(':' . $key, $value, $string);
        }
        return $string;
    }
}
开发者ID:rogerapras,项目名称:aBillander,代码行数:14,代码来源:HelperFunctions.php

示例12: postLogin

 public function postLogin()
 {
     try {
         // Set login credentials
         $credentials = array('email' => Input::get('email'), 'password' => Input::get('password'));
         // Try to authenticate the user
         Sentry::authenticate($credentials, Input::get('remember'));
         return Redirect::to('/');
     } catch (Exception $e) {
         $exception = get_class($e);
         $msg = Lang::has("sentry.{$exception}") ? Lang::get("sentry.{$exception}") : $e->getMessage();
         Session::flash('error', $msg);
     }
     return Redirect::to('/login');
 }
开发者ID:thomaswelton,项目名称:laravel,代码行数:15,代码来源:AuthController.php

示例13: getPermissions

 /**
  * Получение спсика доступных прав из конфига
  *
  * @return array
  */
 public static function getPermissions()
 {
     $permissions = [];
     foreach (config('permissions', []) as $module => $actions) {
         $langKey = $module . '::' . 'permissions.title';
         if (\Lang::has($langKey)) {
             $title = trans($langKey);
         } else {
             $title = ucfirst($module);
         }
         foreach ($actions as $action) {
             $permissions[$title][$module . '::' . $action] = trans($module . '::permissions.' . $action);
         }
     }
     return $permissions;
 }
开发者ID:BlueCatTAT,项目名称:kodicms-laravel,代码行数:21,代码来源:ACL.php

示例14: tableBody

function tableBody($rows, $data, $buttons)
{
    $keys = array_keys($data);
    $response = "";
    $i = 1;
    foreach ($rows as $row) {
        $response .= "<tr><td>" . $i . "</td>";
        foreach ($keys as $key) {
            if (strpos($key, '->') !== false) {
                $key = explode('->', $key);
                $response .= "<td>" . $row->{$key}[0]->{$key}[1] . "</td>";
            } elseif (!is_array($row->{$key})) {
                $response .= "<td>";
                if ($key == "created_at" || $key == "updated_at") {
                    $response .= "<span class='datetime'>" . jDate::forge($row->{$key})->format('H:i:s %Y/%m/%d') . "</span>";
                } elseif (strpos($key, 'date') !== false) {
                    $response .= "<span class='datetime'>" . jDate::forge($row->{$key})->format('%Y/%m/%d') . "</span>";
                } else {
                    $response .= Lang::has('translate.' . $row->{$key}) ? trans('translate.' . $row->{$key}) : $row->{$key};
                }
                $response .= "</td>";
            }
        }
        $response .= '<td><div class="btn-group">
						<button class="btn btn-default btn-xs" type="button">' . trans('translate.Actions') . '</button>
						<button data-toggle="dropdown" class="btn btn-xs btn-primary dropdown-toggle" type="button">
							<span class="caret"></span><span class="sr-only">Toggle Dropdown</span>
						</button>
						<ul role="menu" class="dropdown-menu pull-right">';
        foreach ($buttons as $button) {
            preg_match('/\\{(.*?)\\}/', $button['url'], $param);
            $url = preg_replace("/\\{[^)]+\\}/", $row->{$param}[1], $button['url']);
            $response .= '<li><a href="' . $url . '">';
            if (Lang::has('translate.' . $button['label'])) {
                $response .= trans('translate.' . $button['label']);
            } else {
                $response .= $button['label'];
            }
            $response .= '</a></li>';
        }
        $response .= '</ul>
						</div></td>';
        $response .= "</tr>";
        $i = $i + 1;
    }
    return $response;
}
开发者ID:wellbornman,项目名称:laravel-dev,代码行数:47,代码来源:ListHelper.php

示例15: lang

/**
 * Translate to chinese.
 *
 * @param $string
 * @param $string
 *
 * @return string
 */
function lang($target, $default)
{
    return Lang::has($target) ? Lang::get($target) : $default;
}
开发者ID:magicians,项目名称:learner.video,代码行数:12,代码来源:helpers.php


注:本文中的Lang::has方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。