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


PHP MessageBag::get方法代碼示例

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


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

示例1: testFormatIsRespected

 public function testFormatIsRespected()
 {
     $container = new MessageBag();
     $container->setFormat('<p>:message</p>');
     $container->add('foo', 'bar');
     $container->add('boom', 'baz');
     $this->assertEquals('<p>bar</p>', $container->first('foo'));
     $this->assertEquals(array('<p>bar</p>'), $container->get('foo'));
     $this->assertEquals(array('<p>bar</p>', '<p>baz</p>'), $container->all());
     $this->assertEquals('bar', $container->first('foo', ':message'));
     $this->assertEquals(array('bar'), $container->get('foo', ':message'));
     $this->assertEquals(array('bar', 'baz'), $container->all(':message'));
 }
開發者ID:hochanh,項目名稱:Bootsoft-Bowling,代碼行數:13,代碼來源:MessageBagTest.php

示例2: getErrorMessages

 /**
  * @param string $key
  * @return array
  */
 public function getErrorMessages($key)
 {
     if ($this->errors !== null) {
         return $this->errors->get($key);
     }
     return [];
 }
開發者ID:autocar,項目名稱:FluentForm,代碼行數:11,代碼來源:Base.php

示例3: get

 /**
  * Check for the key in the error manager session else return the messages 
  * from the message bag
  *
  * @param  string  $key
  * @param  string  $format
  * @return array
  */
 public function get($key, $format = null)
 {
     if (Session::has('errorManager.errors')) {
         $errors = new parent(Session::get('errorManager.errors'));
         if ($errors->has($key)) {
             return $errors->get($key);
         }
     }
     return parent::get($key);
 }
開發者ID:michaeljennings,項目名稱:errormanager,代碼行數:18,代碼來源:ErrorManager.php

示例4: __construct

 /**
  * Constructor.
  *
  * @param int                           $httpStatusCode   HTTP status code
  * @param mixed                         $errorCode        Internal error code
  * @param string                        $errorTitle       Error description
  * @param Illuminate\Support\MessageBag $errors           Validation errors
  */
 public function __construct($httpStatusCode, $errorCode, $errorTitle, ValidationMessages $errors = NULL)
 {
     $data = ['errors' => []];
     if ($errors) {
         foreach ($errors->keys() as $field) {
             foreach ($errors->get($field) as $message) {
                 $data['errors'][] = ['status' => $httpStatusCode, 'code' => $errorCode, 'title' => 'Validation Fail', 'detail' => $message, 'meta' => ['field' => $field]];
             }
         }
     }
     parent::__construct($data, $httpStatusCode);
 }
開發者ID:peacefrog333,項目名稱:laravel-jsonapi,代碼行數:20,代碼來源:MultiErrorResponse.php

示例5: get

 /**
  * Gets all the flash messages of a given type.
  * @param $key
  * @param $format
  * @return array
  */
 public function get($key, $format = null)
 {
     $message = parent::get($key, $format);
     $this->purge();
     return $message;
 }
開發者ID:betes-curieuses-design,項目名稱:ElieJosiePhotographie,代碼行數:12,代碼來源:FlashBag.php

示例6: getError

 /**
  * Get error text from session in parent class
  *
  * @param  string $name
  *
  * @return string
  */
 private function getError($name = null)
 {
     return $this->local_errors->get($name);
 }
開發者ID:stolz,項目名稱:laravel-form-builder,代碼行數:11,代碼來源:Foundation.php

示例7: getWarnings

 /**
  * Get the warning messages for a form control.
  *
  * @param string $key
  * @return array of message strings
  */
 public function getWarnings($key)
 {
     return array_merge($this->warning_messages->get($key), $this->getWarningsFromAncestor($key));
 }
開發者ID:fewagency,項目名稱:fluent-form,代碼行數:10,代碼來源:AbstractControlBlockContainer.php


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