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 Conditionable trait to ComponentAttributeBag #39861

Merged
merged 2 commits into from
Dec 1, 2021
Merged

[8.x] Add Conditionable trait to ComponentAttributeBag #39861

merged 2 commits into from
Dec 1, 2021

Conversation

usernotnull
Copy link
Contributor

This is a simple PR to make the ComponentAttributeBag use Conditionable trait.

$attributes
    ->except('href')
    ->when($error, fn ($attributes) => $attributes->merge(['class' => 'bg-warning']));

The above code is compact and provides better readability than using blade's @if or php if blocks.

@taylorotwell taylorotwell merged commit c8319a8 into laravel:8.x Dec 1, 2021
@usernotnull usernotnull deleted the feat-conditionable-component-attribute-bag branch December 1, 2021 13:16
@GrahamCampbell GrahamCampbell changed the title Add Conditionable trait to ComponentAttributeBag [8.x] Add Conditionable trait to ComponentAttributeBag Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants