本文整理汇总了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'));
}
示例2: getErrorMessages
/**
* @param string $key
* @return array
*/
public function getErrorMessages($key)
{
if ($this->errors !== null) {
return $this->errors->get($key);
}
return [];
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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));
}