Explore 40 lesser-known Laravel Blade directives that can streamline your code and enhance its readability. This guide covers directives for conditional statements, loops, attribute management, components, CSRF protection, debugging, and more. It also teaches how to create custom Blade directives, empowering developers to
Table of contents
40 Laravel ‘@’ Blade Directives You Might Not Know and How to Create Custom OnesConditional Directives1. @if , @elseif , @else , and @endif2. @switch and @case3. @isset and @endisset4. @empty and @endempty5. @auth and @endauth6. @guest and @endguest7. @can and @endcan8. @cannot and @endcannot9. @env and @endenv10. @production and @endproductionLoop Directives11. @foreac h , @endforeach, @forelse , and @endforelse12. @for and @endfor13. @while and @endwhile14. @loop — Loop VariablesAttribute Directives15. @class16. @disabled17. @checked, @selected, and @readonly18. @prependComponent and Layout Directives19. @include , @includeIf , @includeWhen , and @includeUnless20. @extends and @endsection21. @yield and @section22. @push and @stack23. @component and @endcomponent24. @slotCSRF and Method Directives25. @csrf26. @methodDebugging and Utility Directives27. @dd and @dump28. @json29. @inject30. @verbatim and @endverbatim31. @unless32. @hasSection33. @sectionMissing34. @section35. @style36. @each37. @once38. @use39. @fragment40. @php1 Comment
Sort: