If the statement is equivalent to the PHP syntax
@if (count($records) === 1)
I have a record!
@elseif (count($records) > 1)
I have more records!
@ The else I do not have any records!
@endif
For convenience, Blade also provides a @unless
command
@unless (Auth::check())
You are not logged in.
@endunless
In addition to the above conditional instructions, @isset
and @empty
instructions may also be considered to have the same functional capabilities PHP
@isset($records)
// $ records are defined and not empty ...
@endisset @empty($records)
// $ records is "empty" of ...
@endempty
Authentication Shortcuts
@auth
And @guest
instructions can be used to quickly determine whether the current user has been authenticated, whether for visitors
@auth
// user has passed the authentication ...
@endauth @guest
// The user does not pass the authentication ...
@endguest