Day 111: Blade templates

Dan Esmail - 4/21/2023

Intro

Another day with Blade, another day to learn more about it. When learning I make sure to read as much of an article as I can till it just stops making sense or when I feel overloaded. I mostly do this because I think you need practice to understand everything within a framework or language. Practice is always king.

Info

On the surface, these blade templates can be very simple or extremely complicated. With Blade, you can just use raw HTML code and you’ll be fine. On the flip side there are a bunch of things that can be added like directives, components, layouts, and more. Right now I’m starting with raw HTML code, but as I move forward I know I have the tools to make my blade templates even better.

Directives

Directives are pretty simple on the surface. They are a that you can input PHP code into the body of your blade template with things like @IF, @Style, and a bunch of other keywords. That’s the only problem with this there are a lot of keywords that can be used. Almost every function that PHP has there is a directive. There are also directives for style, authentication, Environments, and even sections.

Components

This is where things started to go over my head. The components seem to be great when looking at them. I would love to understand them a little bit more to implement them. What they are is tiny snips of code that can be rendered within a view. How that is all done is a little mystery to me.

Blade templates are great with all the functionality they provide from directives to components. The more that you learn about them the more powerful they become. I really need to take time and start practicing getting all the views within my website so I can understand how they work.



Day 1

Day 1