1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 13:24:03 +00:00
laravel-tips/content/tips/you-can-use-at-includewhen-to-include-certain-blade-partials-when-some-condition-is-met-for-instance-when-the-current-user-is-an-admin.md
2022-01-14 19:18:35 +01:00

601 B

title tweet_id thread_slug author_username images created_at slug
You can use @includeWhen to include certain Blade partials when some condition is met. For instance, when the current user is an admin 1482036560354676737 weekly-thread-2022-02 marcelpociot
https://pbs.twimg.com/media/FI47GaYXMAI7SeA.jpg
2022-01-14T17:07:05+00:00 you-can-use-at-includewhen-to-include-certain-blade-partials-when-some-condition-is-met-for-instance-when-the-current-user-is-an-admin

Make use of the built-in "includeWhen" and "includeUnless" directives to get rid of those ugly if conditions.