How to Create Blade File using Command in Laravel 11?
Hi, Dev
In this brief post, I'll demonstrate how to create a view blade file in a Laravel 11 application using an artisan command. We will utilize the `make:view` artisan command to generate the blade file.
Laravel has recently released version 11, featuring a significant improvement: a new Artisan command option for creating Blade files. Now, you can effortlessly generate a view file in Laravel 11 by running the following simple command: `php artisan make:view welcome`. This command streamlines the process of creating Blade files using Artisan.
So, let's see the simple example below:
Example 1: Laravel 11 Create Blade File Command
Here, the below command will help you to create 'dashboard.blade.php' file. so, let's run it and check the output as well.
php artisan make:view dashboard
You can see the following output:
they will create new file as like the below:
resources/views/dashboard.blade.php
<div>
<!-- Live as if you were to die tomorrow. Learn as if you were to live forever. - Mahatma Gandhi -->
</div>
Example 2: Laravel 11 Create Blade File inside Directory Command
Here, the below command will help you to create 'index.blade.php' file in users folder. so, let's run it and check the output as well.
php artisan make:view users.index
You can see the following output:
they will create new file as like the below:
resources/views/users/index.blade.php
<div>
<!-- He who is contented is rich. - Laozi -->
</div>
These commands really help us.
- How to Notifications With database Driver in Laravel 11?
- How to Send Email Via Notification in Laravel 11?
- How to Install and Configure Laravel 11 Debugbar?
- How to Like Dislike System in Laravel 11?
- How to Paginate a Model with Relationship in Laravel 11?
- Laravel 11 Upload Files to Amazon S3 Example
- Laravel 11 Send WhatsApp Messages Example
- Laravel 11 Rest API Authentication Using JWT Tutorial