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

[Feature] Added custom "blank" and "filled" Blade directives #1951

Merged
merged 1 commit into from
Dec 24, 2024

Conversation

alexjustesen
Copy link
Owner

πŸ“ƒ Description

This PR adds custom Blade templates @blank and @filled to improve readability as it was rejected in the core: laravel/framework#51561

πŸͺ΅ Changelog

βž• Added

  • @blank and @filled Blade templates to improve readability.

πŸ€” Usage

Using @blank() in a view:

// before
@if (blank())
    i am blank
@endif

// after
@blank($var)
    i am blank
@endblank

Using @filled() in a view:

// before
@if (! blank($var))
    i am not blank (filled)
@endif

// or

@if (filled($var))
    i am not blank (filled)
@endif

// after
@filled($var)
    i am not blank (filled)
@endfilled

@alexjustesen alexjustesen added the πŸŽ‰ feature New feature or request label Dec 24, 2024
@alexjustesen alexjustesen self-assigned this Dec 24, 2024
@alexjustesen alexjustesen merged commit 7dc54e1 into main Dec 24, 2024
1 check passed
@alexjustesen alexjustesen deleted the define-blank-and-filled-blade-if-statements branch December 24, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
πŸŽ‰ feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant