本文整理汇总了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);
}
示例2: hasLang
public static function hasLang($string)
{
if (static::isLaravel()) {
return \Lang::has($string);
}
return false;
}
示例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.';
}
}
示例4: translateAttribute
function translateAttribute($string)
{
$new = 'shapeshifter::attributes.' . $string;
if (Lang::has($new)) {
return ucfirst(Lang::get($new));
}
return ucfirst($string);
}
示例5: get_trans
function get_trans($name)
{
if (Lang::has('all.' . $name)) {
return trans('all.' . $name);
} else {
return $name;
}
}
示例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'));
}
示例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);
}
示例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]);
}
示例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);
}
示例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;
}
示例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;
}
}
示例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');
}
示例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;
}
示例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;
}
示例15: lang
/**
* Translate to chinese.
*
* @param $string
* @param $string
*
* @return string
*/
function lang($target, $default)
{
return Lang::has($target) ? Lang::get($target) : $default;
}