If you run the artisan command in the console, you can observe that there is a section called Stub and the only command in that section is php artisan stub:publish.
If you run this command, it will generate a new folder called Stubs in your application root folder containing a bunch of files with a .stub extension.
You can open these files and modify or customize them as needed. From now on, your Laravel application will read in this folder templates for making various things that crafters typically make.
This template is included with every Laravel installation, and publishing them is completely optional. In fact, there are many software packages dedicated to making custom controllers or models, such as this one from Spatie p>
Internal structure above the generator
Laravel has two cores,
The first in application/console/kernel
The second
in app/Http/kernel
When you run artisan, Laravel bootstraps the application and runs the kernel console. The two kernels have different purposes and actually run as separate applications.
Regarding the specific generation of the above files, I mean different controllers, models, migrations, etc. Everything related to the model is generated from a class.
Class ModelMakeCommand extends GeneratorCommand{ .... }
Located under the Illuminate\Foundation\Console namespace.
You can inspect the code for this class and see how the stub files are used to generate only various commands related to the model, but there are many more, such as strategies, events, Homework etc...
These files are generated from stub files. Below are some stub directory locations on any Laravel project. You can check this out.
For models:
other:
If you want to control these stubs you must apply the following commands
This command will publish the stub files in the "stubs" folder of the project directory. You can then customize it to suit your needs.
Everything generated in Laravel uses templates
If you run the artisan command in the console, you can observe that there is a section called Stub and the only command in that section is
php artisan stub:publish
.If you run this command, it will generate a new folder called Stubs in your application root folder containing a bunch of files with a .stub extension.
You can open these files and modify or customize them as needed. From now on, your Laravel application will read in this folder templates for making various things that crafters typically make.
This template is included with every Laravel installation, and publishing them is completely optional. In fact, there are many software packages dedicated to making custom controllers or models, such as this one from Spatie p>
Internal structure above the generator Laravel has two cores,
When you run artisan, Laravel bootstraps the application and runs the kernel console. The two kernels have different purposes and actually run as separate applications.
Regarding the specific generation of the above files, I mean different controllers, models, migrations, etc. Everything related to the model is generated from a class.
Class ModelMakeCommand extends GeneratorCommand{ .... }
Located under the
Illuminate\Foundation\Console
namespace.You can inspect the code for this class and see how the stub files are used to generate only various commands related to the model, but there are many more, such as strategies, events, Homework etc...
I hope this helps you and answers your questions
Here is more information on this topicFrom Laravel News p>