DEV Community

Cover image for Laravel 12 Create Blade File using Command Example
Saddam Hossain
Saddam Hossain

Posted on

Laravel 12 Create Blade File using Command Example

In this short post, i will show you how to create view blade file using artisan command in laravel 12 application. we

will use make:view artisan command to create blade file. Laravel has recently launched version 11, which includes a notable enhancement: the addition of a new Artisan command

option for creating Blade files. You can now generate a view file in Laravel 12 by executing the following

straightforward command: php artisan make:view welcome. This command simplifies the

process of creating Blade files via the Artisan command.

Example 1: Laravel 12 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
Enter fullscreen mode Exit fullscreen mode

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>
Enter fullscreen mode Exit fullscreen mode

Example 2: Laravel 12 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
Enter fullscreen mode Exit fullscreen mode

they will create new file as like the below:

resources/views/users/index.blade.php

Read Also: Laravel File Upload with Progress Bar Example

<div>
    <!-- He who is contented is rich. - Laozi -->
</div>
Enter fullscreen mode Exit fullscreen mode

These commands really help us.

Top comments (0)