Posty

Wyświetlanie postów z listopad, 2022

Blade Templates

Obraz
 For clear code view purposes to present it on the blog I didn't use templates in my project but in real world development to avoid code repetition and make the code look tidy, blade template are used in every laravel based project. I will now demonstrate how blade templates work creating a footer which will be visible at almost every page of my website.  Footer Template view: Implementing that template in other views: @include method allows to include a blade view from within another view. All variables that are available to the parent view will be made available to the included view. Now every page will have the same footer: To create whole layouts for our pages we can also use @yield and @section methods Head Layout View:   As an example (I will change it back in my code after showing this example, this is just for explanation purposes) in a layout file we put the HTML tag and all needed head elements, and links we will use in every page. With @yield we then say tha...