Skip to main content

Laravel Template blade concept

 All Laravel view files need to store at resources folder. 


Blade Document: https://laravel.com/docs/9.x/blade

Blade template always have blade extension

For ex:

Home.php as Home.blade.php



{{}} ==> it will print variable data simply act like PHP echo statements.

@directive it is used for template or nested template, loops and conditions statements


By default, Blade {{ }} statements are automatically sent through PHP's htmlspecialchars function to prevent XSS attacks. If you do not want your data to be escaped, you may use the following syntax:

{!! $title !!}







As refer above image, you can simply create a layout.blade.php for common page.

Let take sample example html template



In Layout



Yield second parameter will be a default value if you doesn't set any title value. 


















Comments

Popular posts from this blog

Business hours calculation using PHP

Most of ticketing alert projects needed SLA calculation to exclude holidays and weekends or Off business hours. First of all, let us take a look at types of SLA we need to calculate. For instance, few companies will work 24/7 shifts and 8x5, 8x7 etc. So we need to consider business hours. In this example, I'm considering business hours which starts at 09:00 AM and ends at 06:00 PM. Also, using this code we can calculate 24/7 too. Let's consider business hours started at 9:00 AM to 18:00 PM without weekends. Now, take the actual work start period and end period.                                                       Demo <?php $incident_work_started = '2018-09-12 09:28:07'; $incident_work_ended = '2018-09-19 17:45:00'; $totalHours = round(get_working_hours($incident_work_started,$incident_work_ended),2)."\n"; e...

Laravel all artisan commands and uses

Laravel all artisan commands and uses  Laravel commands Have you all know, Laravel run on mostly PHP artisan commands. here I'm going to provide a quick image that show all artisan commands on Laravel.  If do you want to check all Laravel commands, Just run the command on your CMD php artisan You will get all the commands 

Select 2 options with live examples

Select2 options Select2 gives you a customizable select box with support for searching, tagging, remote data sets, infinite scrolling, and many other highly used options. Here I prepared for all set of examples with sample codes, You don't need to read entire document to do this See the Pen Select2 examples from Codesponsors.com by Codesponsors ( @Codesponsors ) on CodePen .