Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
aac25078
Commit
aac25078
authored
Mar 02, 2012
by
Jason Lewis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When no key is provided to first it returns the first message from all the messages.
parent
2032dec0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
messages.php
laravel/messages.php
+7
-2
No files found.
laravel/messages.php
View file @
aac25078
...
@@ -64,6 +64,9 @@ class Messages {
...
@@ -64,6 +64,9 @@ class Messages {
* Get the first message from the container for a given key.
* Get the first message from the container for a given key.
*
*
* <code>
* <code>
* // Echo the first message out of all messages.
* echo $messages->first();
*
* // Echo the first message for the e-mail attribute
* // Echo the first message for the e-mail attribute
* echo $messages->first('email');
* echo $messages->first('email');
*
*
...
@@ -75,9 +78,11 @@ class Messages {
...
@@ -75,9 +78,11 @@ class Messages {
* @param string $format
* @param string $format
* @return string
* @return string
*/
*/
public
function
first
(
$key
,
$format
=
':message'
)
public
function
first
(
$key
=
null
,
$format
=
':message'
)
{
{
return
(
count
(
$messages
=
$this
->
get
(
$key
,
$format
))
>
0
)
?
$messages
[
0
]
:
''
;
$messages
=
is_null
(
$key
)
?
$this
->
all
(
$format
)
:
$this
->
get
(
$key
,
$format
);
return
(
count
(
$messages
)
>
0
)
?
$messages
[
0
]
:
''
;
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment