Hello developers in this tutorial we will discuss about how to create custome artisan command and how to create dynamic view in laravel
S.no | Contents-topics |
---|---|
1 | What are Artisan commands |
2 | Create custom artisan command for view |
3 | Code for command view file |
4 | Entering artisan command |
Artisan commands are similar to commands on CMD or commands which we enter in terminal to make changes , Laravel comes with inbuilt command line interface that name is Artisan , by the use artisan command we can make jobs , model , controller , migration and many more with the artisan command
For creating new custom artisan for creating view , simply open the terminal and hit the below command with respective to file name.
Copy for creating artisan commandCopy
Inside app/console/Commands/ you can see createViewFile.php
Also read: AUTH GUARD IN LARAVEL 10 , MAKE MODEL AUTHENTICABLE IN LARAVEL 10
createViewFile.php code: Copy
Here protected $signature = 'make:view {view}'; represents how to start this command and {view} means what should be name of our view file after that in handle() function consist of main logic behind the command to be executable.
command: Copy
Also read: HOW TO MAKE TRAITS IN LARAVEL 10.
0 Comments (Please let us know your query)