47

10 Underused Laravel Blade Directives

 5 years ago
source link: https://www.tuicool.com/articles/hit/zaAJb2y
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Laravel Blade is the template engine that’s built into the framework. It makes working with HTML a breeze. I have been working with Laravel for more than a year, but never realized some of Blade’s features. I want to share with you 10 underused blade directives that will clean up your code and save some time in the process. Let’s get going.

Check out LaravelCollections.com - an ever growing collection of great Laravel resources

@forelse

j2eIZnv.png!web

@each

Ynmayqf.png!web

@json

QrUFvar.png!web

@verbatim

JvABNfe.png!web

@isset & @ empty

3AjuaaN.png!web

@php

BjeMraf.png!web

@push & @stack

q6jQBvi.png!web

@inject

rM7jqqZ.png!web

@includeWhen

UvQn2yF.png!web

@hasSection

biIvyur.png!web

Conclusion

I hope these tips help you write better Blade views. If you have a tip do, share with us. I have linked to a few resources, which will help you take you Laravel skill to the next level.

  1. LaravelCollections.com
  2. Laravel Blade Documentation
  3. Scotch.io tutorial
  4. Custom Blade directives package

Thanks for reading, share this article with people who might be interested.

This has been Adi -Simplest Web


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK