當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Lang::has方法代碼示例

本文整理匯總了PHP中Illuminate\Support\Facades\Lang::has方法的典型用法代碼示例。如果您正苦於以下問題:PHP Lang::has方法的具體用法?PHP Lang::has怎麽用?PHP Lang::has使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Support\Facades\Lang的用法示例。


在下文中一共展示了Lang::has方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: login

 /**
  * Handle a login request to the application.
  * Requires $this->usernameField, password, remember request fields.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function login(Request $request)
 {
     $this->validate($request, [$this->usernameField => 'required', 'password' => 'required']);
     // Check whether this controller is using ThrottlesLogins trait
     $throttles = in_array(ThrottlesLogins::class, class_uses_recursive(get_class($this)));
     if ($throttles && $this->hasTooManyLoginAttempts($request)) {
         return $this->sendLockoutResponse($request);
     }
     $credentials = $request->only($this->usernameField, 'password');
     // Try to authenticate using username or NIM
     if (Auth::attempt(['username' => $request[$this->usernameField], 'password' => $request['password']], $request->has('remember')) || Auth::attempt(['nim' => $request[$this->usernameField], 'password' => $request['password']], $request->has('remember'))) {
         // Authentication successful
         if ($throttles) {
             $this->clearLoginAttempts($request);
         }
         return redirect()->intended($this->redirectLogin);
     }
     // If the login attempt was unsuccessful we will increment the number of attempts
     // to login and redirect the user back to the login form. Of course, when this
     // user surpasses their maximum number of attempts they will get locked out.
     if ($throttles) {
         $this->incrementLoginAttempts($request);
     }
     $failedLoginMessage = Lang::has('auth.failed') ? Lang::get('auth.failed') : 'These credentials do not match our records.';
     return redirect()->back()->withInput($request->only($this->usernameField, 'remember'))->withErrors([$this->usernameField => $failedLoginMessage]);
 }
開發者ID:stei2015,項目名稱:webstei2015,代碼行數:33,代碼來源:AuthController.php

示例2: get

 /**
  * Return a modules.
  *
  * @return \Illuminate\Support\Collection
  */
 public function get(Module $module)
 {
     $moduleName = $module->getName();
     if (Lang::has("{$moduleName}::module.title")) {
         $module->localname = Lang::get("{$moduleName}::module.title");
     } else {
         $module->localname = $module->getStudlyName();
     }
     if (Lang::has("{$moduleName}::module.description")) {
         $module->description = Lang::get("{$moduleName}::module.description");
     }
     $package = $this->packageVersion->getPackageInfo("societycms/module-{$moduleName}");
     if (isset($package->name) && strpos($package->name, '/')) {
         $module->vendor = explode('/', $package->name)[0];
     }
     $module->version = isset($package->version) ? $package->version : 'N/A';
     $module->versionUrl = '#';
     $module->isCore = $this->isCoreModule($module);
     if (isset($package->source->url)) {
         $packageUrl = str_replace('.git', '', $package->source->url);
         $module->versionUrl = $packageUrl . '/tree/' . $package->dist->reference;
     }
     $module->license = $package->license;
     return $module;
 }
開發者ID:SocietyCMS,項目名稱:Modules,代碼行數:30,代碼來源:ModuleManager.php

示例3: t

 /**
  * Get a string from language file.
  *
  * @param  string  $string
  * @param  string  $default
  * @param  array   $parameters
  * @return mixed
  */
 function t($string, $default = null, $parameters = [])
 {
     if (Lang::has($string)) {
         return Lang::get($string, $parameters);
     }
     return $default;
 }
開發者ID:shammadahmed,項目名稱:LaravelHelpers,代碼行數:15,代碼來源:helpers.php

示例4: testDefaultPlaceholderTextsAreDefined

 public function testDefaultPlaceholderTextsAreDefined()
 {
     $types = ['asset', 'location', 'link', 'text', 'html', 'feature', 'library', 'linkset', 'slideshow', 'timestamp'];
     foreach ($types as $type) {
         $langKey = "boomcms::chunks.{$type}.default";
         $this->assertTrue(Lang::has($langKey), $type);
     }
 }
開發者ID:robbytaylor,項目名稱:boom-core,代碼行數:8,代碼來源:BaseChunkTest.php

示例5: has

 public function has($message, $package = '')
 {
     $found = Lang::has($message);
     if ($package != '') {
         $found = $found || Lang::has($package . '::' . $message);
     }
     return $found || Lang::has('translation::' . $message);
 }
開發者ID:ixudra,項目名稱:translation,代碼行數:8,代碼來源:LanguageHelper.php

示例6: getObjectTransValue

 /**
  *  Funtion to set ObjectTrans variable
  *
  * @access  public
  * @param   array   $parameters
  * @param   string  $objectTrans
  * @return  string
  */
 public static function getObjectTransValue($parameters, $objectTrans)
 {
     if (Lang::has($parameters['package'] . '::pulsar.' . $objectTrans)) {
         return $parameters['package'] . '::pulsar.' . $objectTrans;
     } elseif (Lang::has('pulsar::pulsar.' . $objectTrans)) {
         return 'pulsar::pulsar.' . $objectTrans;
     }
 }
開發者ID:syscover,項目名稱:pulsar,代碼行數:16,代碼來源:Miscellaneous.php

示例7: key

 /**
  * Evalutes column name
  *
  * @param $key
  * @return mixed
  */
 public function key($key)
 {
     if (Lang::has('strings.' . $key)) {
         return Lang::get('strings.' . $key);
     } else {
         return $key;
     }
 }
開發者ID:Ajaxman,項目名稱:SaleBoss,代碼行數:14,代碼來源:CommonDataPresenter.php

示例8: has

 public function has($key, $locale = null)
 {
     if (Lang::has($this->namespaced($key, true), $locale)) {
         return true;
     } else {
         return Lang::has($this->namespaced($key), $locale);
     }
 }
開發者ID:spescina,項目名稱:platform-core,代碼行數:8,代碼來源:Language.php

示例9: options

 public static function options()
 {
     $options = [];
     foreach (Config::get('boomcms.settingsManagerOptions') as $name => $type) {
         $langPrefix = "boomcms::settings-manager.{$name}.";
         $options[] = ['name' => $name, 'label' => Lang::get("{$langPrefix}_label"), 'type' => $type, 'value' => Settings::get($name), 'info' => Lang::has("{$langPrefix}_info") ? Lang::get("{$langPrefix}_info") : ''];
     }
     usort($options, function ($a, $b) {
         return $a['label'] < $b['label'] ? -1 : 1;
     });
     return $options;
 }
開發者ID:robbytaylor,項目名稱:boom-core,代碼行數:12,代碼來源:Manager.php

示例10: __call

 /**
  * Create localizated Route
  * 
  * @param string $name [ get, post, put, delete, patch ]
  * @param array $args
  * @return \Illuminate\Routing\Router
  */
 public function __call($name, $args)
 {
     $methods = ['get', 'post', 'put', 'delete', 'patch'];
     if (in_array($name, $methods)) {
         list($uri, $as, $uses, $locale) = $args;
         if (Lang::has($uri)) {
             $uri = Lang::get($uri, [], $locale);
         }
         if ($locale) {
             $as = "{$locale}.{$as}";
         }
         return $this->app['router']->{$name}($uri, ['as' => $as, 'uses' => $uses]);
     }
 }
開發者ID:sheepy85,項目名稱:l5-localization,代碼行數:21,代碼來源:Router.php

示例11: check

 public function check($controller_suffix = 'Controller')
 {
     $routeAction = Route::currentRouteAction();
     preg_match_all('/([a-z0-9A-Z]+\\\\)?(\\w+)@(\\w+)/', $routeAction, $matchs);
     $controller_full = $matchs[2][0];
     //類名
     $controller = str_replace($controller_suffix, '', $controller_full);
     $action = $matchs[3][0];
     //方法名
     //不需要認證的模塊,則放行
     if (isset($this->config['AUTH_LOGIN_NO'][$controller]) && ($this->config['AUTH_LOGIN_NO'][$controller] == '*' || in_array($action, $this->config['AUTH_LOGIN_NO'][$controller]))) {
         return true;
     }
     //沒有登陸跳轉到登陸頁麵
     if (!$this->checkLogin()) {
         //todo
         return $this->noLogin();
     }
     $power = $this->getRolePower(Session::get($this->config['AUTH_SESSION_PREFIX'] . 'role_id'));
     //臨時的,記得刪除-1 todo
     //$power = -1;
     if ($power == -1) {
         return true;
     } else {
         $privilege = Lang::has('privilege') ? Lang::get('privilege') : array();
         $controller = str_replace('Controller', '', $controller);
         if ($privilege) {
             if (isset($privilege[$controller]['power_rule']['module_hidden'])) {
                 if ($privilege[$controller]['power_rule']['module_hidden'] == 0) {
                     if (isset($privilege[$controller][$action])) {
                         if (isset($privilege[$controller]['power_rule'][$action]) && $privilege[$controller]['power_rule'][$action] == 1) {
                             return true;
                         } else {
                             if (isset($power[$controller][$action]) && $power[$controller][$action] == -1) {
                                 return true;
                             }
                         }
                     } else {
                         //沒有設置$privilege[$controller][$action]一律通過
                         return true;
                     }
                 } elseif ($privilege[$controller]['power_rule']['module_hidden'] == 1) {
                     return true;
                 }
             }
         }
     }
     return $this->noPower();
 }
開發者ID:zhangmazi,項目名稱:laravel-zacl,代碼行數:49,代碼來源:Zacl.php

示例12: sendGet

 /**
  * Get the page navigation by working.
  *
  * @return array
  */
 protected function sendGet()
 {
     $model = $this->model;
     $pages = $model::where('show_nav', '=', true)->get(['nav_title', 'slug', 'icon'])->toArray();
     foreach ($pages as $key => $page) {
         $pages[$key]['slug'] = 'pages/' . $page['slug'];
         if (Lang::has('navigation.' . $page['nav_title'])) {
             $pages[$key]['title'] = trans('navigation.' . $page['nav_title']);
         } else {
             $pages[$key]['title'] = $page['nav_title'];
         }
         unset($pages[$key]['nav_title']);
     }
     return $pages;
 }
開發者ID:xhulioh25,項目名稱:wiki,代碼行數:20,代碼來源:PageRepository.php

示例13: listTranslated

 /**
  * Create a list based on localisation
  *
  * @param string $prefix The localization prefix/file
  * @param string $key The key column in the resulting array
  * @param string $value The value column in the resulting array
  * @return Array The array containing the list
  *
  * @author Zaïd Sadhoe <zaid@10forward.nl>
  */
 public static function listTranslated($prefix = '', $key = 'id', $value = 'name')
 {
     $results = self::lists($value, $key);
     foreach ($results as $key => &$value) {
         if (Lang::has($prefix . $key)) {
             $value = Lang::get($prefix . $key);
         } else {
             if (Lang::has($prefix . $value)) {
                 $value = Lang::get($prefix . $value);
             }
         }
     }
     asort($results);
     return $results;
 }
開發者ID:AccessibilityNL,項目名稱:User-Testing-Tool,代碼行數:25,代碼來源:BaseModel.php

示例14: getPageText

 /**
  * Get a translated string for an error page.
  * Either a specific one if defined or a generic if not.
  *
  * @param       $key
  * @param       $code
  * @param array $options
  *
  * @return string
  */
 public static function getPageText($key, $code, $options = [])
 {
     $cSpecificKey = "pretty-error-page-customized::{$code}.{$key}";
     $cGenericKey = "pretty-error-page-customized::generic.{$key}";
     $specificKey = "pretty-error-page::{$code}.{$key}";
     $genericKey = "pretty-error-page::generic.{$key}";
     if (Lang::has($cSpecificKey)) {
         return Lang::get($cSpecificKey, $options);
     } else {
         if (Lang::has($cGenericKey)) {
             return Lang::get($cGenericKey, $options);
         } else {
             if (Lang::has($specificKey)) {
                 return Lang::get($specificKey, $options);
             }
         }
     }
     return Lang::get($genericKey, $options);
 }
開發者ID:mscharl,項目名稱:pretty-error-page,代碼行數:29,代碼來源:PrettyErrorPageHelper.php

示例15: getLockoutErrorMessage

 /**
  * Get the login lockout error message.
  *
  * @param  int  $seconds
  * @return string
  */
 protected function getLockoutErrorMessage($seconds)
 {
     return Lang::has('auth.throttle') ? Lang::get('auth.throttle', ['seconds' => $seconds]) : 'Too many login attempts. Account Blocked, an email has been sent to ' . Input::get('email') . " to reset password";
 }
開發者ID:joxtoyod,項目名稱:NotesToMySelf,代碼行數:10,代碼來源:ThrottlesLogins.php


注:本文中的Illuminate\Support\Facades\Lang::has方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。