How to Comment Code in Laravel Blade File?
Hey,
In this profound tutorial, we will learn how to comment in laravel blade file. step by step explain laravel blade comment. In this article, we will implement a laravel add comment laravel blade file. We will use how to add comment code in laravel.
To add a comment in a blade file in Laravel, you can use the {{-- --}} syntax. Anything written within these comment tags will not be rendered in the final HTML output. Here's an example:
You can include comments to explain your code or to temporarily disable certain parts of the code without actually removing them.
Let's see the example code:
Laravel Comment Code in Blade File
Blade File Code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
{{-- <h1>How to comment code in laravel?</h1> --}}
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</body>
</html>
Laravel Comment Code in Controller File
You can use following Normal PHP comments as like the below:
/* multiple line comments */
// single line comments
# simple comments :)
Controller File Code:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$result = Str::containsInSensitive('Hi, Hardik', 'Hardik');
$result2 = Str::containsInSensitive('Hi, Hardik', 'hardik');
dd($result, $result2);
}
}
I hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- How to Count the Number of Words in String in Laravel?
- How to Check String is URL or Not in Laravel?
- Laravel Check If String Starts with Specific Value Example
- How to Convert String to CamelCase in Laravel?
- How to Get Length of String in Laravel?
- Laravel Convert String to Uppercase Example
- Laravel Convert String to Lowercase Example
- Laravel Import Large CSV File Using Queue Example
- How to Replace String in Laravel?
- How to Install and Setup Supervisor in Ubuntu for Laravel?
- Laravel String Contains Case Insensitive Example
- Laravel Stripe Checkout Payment Integration Example
- How to Convert String to Array Conversion in Laravel?