Render tag if condition is true #42716
Unanswered
LeMatosDeFuk
asked this question in
Ideas
Replies: 1 comment
-
You can create a component like this: {{-- views/components/link.blade.php --}}
@props([
'disabled' => false,
])
@if($disabled)
{{ $slot }}
@else
<a {{ $attributes }}>{{ $slot }}</a>
@endif then call <x-link href="..." :disabled="$myCondition">
Hello
</link> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey, I've seen an idea in latte templating engine, where you can specify, if condition is true, then it will render a tag like in this example:
<a href="..." n:tag-if="$clickable">Hello</a>
prints
Hello
when $clickable is falseyprints
<a href="...">Hello</a>
when $clickable is truthyI think this could be a really cool feature and in blade it could look something like this:
This condition should be based on php function strip_tags, which should do the tricks in my opinion.
Here is latte documentation
Tell me what you think about it!
Beta Was this translation helpful? Give feedback.
All reactions