Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Add attribute checking and getting docs. #6697

Merged
merged 1 commit into from
Dec 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions blade.md
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,21 @@ Using the `first` method, you may render the first attribute in a given attribut

{{ $attributes->whereStartsWith('wire:model')->first() }}

<a name="checking-or-getting-attributes"></a>
#### Checking or Getting Attributes

If you would like to check if an attribute is present on the component, you may use the `has` method. This method accepts the attribute name as a parameter and
returns a boolean indicating whether or not the attribute is present.

@if ($attributes->has('class'))
<div>Class attribute is present</div>
@endif

In addition to checking if the attribute is present, you can also get the specific attribute value by using the `get` method. This method does also accept the attribute
name as the first parameter and will return its value.

{{ $attributes->get('class') }}

<a name="slots"></a>
### Slots

Expand Down