It’s time to learn about blade. Blade is a templating engine for PHP. PHP has its own templating engine
but it’s not very friendly and there are other templating engines out
there to make PHP a lot easier to use. This is just a little bit of blade. Let’s create a template in views. Create a new folder. And name it “layout” And in layout Create a new file And name it app (dot) blade (dot) php So this is our main file Where we will have our html I will say it learning laravel We could have many css here All css goes here Ok And All the script files will be here So we can say that This script will be that Which is constant of our application All JS files which are necessary for our app will be here Now we will learn about “yield” Write y i e l d And I will say this section is “header” And let’s create another yield And name it “content” And After all of our script We say “script” So this is our complete layout Let’s save it And in hello (dot) blade (dot) php What I will do I will extend I will say go to My file is in layout folder (dot) app “extends” lets us extend a template, which defines its own sections. A template that we can extend will define its own sections using “yield”, which we can then put our own stuff into in our view file. extends with @section is more powerful and convenient way to use layout, especially in larger applications. It allows to use inheritance. We could provide a base template, and then another child template that extends that one which subsequently yields its own sections. We can then extend that child template. We have app This is our header So we will define our section I will name it header I will say This is header And another section Which is content I will say Section Content And I will write it here And script Let’s say Script Now let’s check this See that Hello This is header. I am from welcome hello file And the data So that’s how we use blade template engine Another thing that I want to show right now Is that, lets create Provide user info I say it, abc @ xyz.com and A B C And X Y Z It’s just an array So let’s pass it to our view And in blade For each For each of user as item And H 2 And Item H2 So this is our for each Save this So that’s how we use blade template engine We also use like this If dollar user zero Let’s say The id is matched And if we say The id is mismatched Thank you so much for watching This lecture I will see you in the next one Take Care.