What is Blade?
Blade is the simple, yet powerful templating engine that is included with Laravel. Unlike some PHP templating engines, Blade does not restrict you from using plain PHP code in your templates.
Blade template files use the .blade.php file extension and are typically stored in the resources/views directory
Blade Template
Displaying Data – You may display data that is passed to your Blade views by wrapping the variable in curly braces.
Blade’s {{ }} echo statements are automatically sent through PHP’s htmlspecialchars function to prevent XSS attacks.
Example:- {{$name}}
Calling Function – You may also echo the results of any PHP function by wrapping the function name in curly braces.
Example:- {{ time( ) }}
Note – You can put any PHP code you wish inside of a Blade echo statement.
Comment
Blade also allows you to define comments in your views. However, unlike HTML comments, Blade comments are not included in the HTML returned by your application.
{{– This comment will not be present in the rendered HTML –}}
Conditional Directives
If Directive
If.. Else.. Directive
If… elseif… else… Directive
Empty Directive
Authentication Directives
Auth Directive
Guest Directive
- Remove Duplicate Records from MySQL Server - October 12, 2021
- How to Secure Your Apache Server - September 10, 2021
- Linux security - September 9, 2021