How to Create View File using Artisan Command in Laravel 10?

27-Dec-2023

.

Admin

How to Create View File using Artisan Command in Laravel 10?

Hello Dev,

In this post, we will learn How to Create a View File using Artisan Command in Laravel 10. we will help you to give examples of How to use artisan to make views in laravel 10. This article goes into detail on How to Create Views using Artisan Command. we will help you to give an example of Laravel 10 Create View File Using Artisan Command Tutorial.

This example focuses on creating a Blade file in Laravel 10 using the command line. It's a simple illustration of using 'php artisan make: view' in Laravel 10 to generate a view file. You will learn how to create a view file in Laravel 10. Let me guide you through the process of creating a Blade file in Laravel 10 using the terminal. Follow the steps below to create a Blade file in Laravel 10 using the command line.

Laravel has recently released version 10.23, bringing a significant enhancement: the addition of a new Artisan command option to create Blade files. Now, in Laravel 10, you can generate a view file effortlessly using the following command: 'php artisan make: view welcome.' This command streamlines the creation of Blade files through Artisan.

So, let's explore a straightforward example below.

Example 1: Laravel 10 Create Blade File Command


Here, the following command will help you create the dashboard.blade.php file. Let's run it and check the output as well.

php artisan make:view dashboard

You can see the following output.

Login And Registration Package

They will create a new file like the one 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 10 Create Blade File inside Directory Command

Here, the following command will assist you in creating the index.blade.php file in the users folder. Let's run it and check the output as well.

php artisan make:view users.index

You can see the following output.

Login And Registration Package

They will create a new file like the one below.

resources/views/users/index.blade.php

<div>

<!-- He who is contented is rich. - Laozi -->

</div>

I hope it can help you...

#Laravel 10