Laravel module to generate view from artisan command
tediscript/laravel-view-generator is a Laravel package for laravel module to generate view from artisan command.
It currently has 1 GitHub stars and 13 downloads on Packagist (latest version v1.0.0).
Install it with composer require tediscript/laravel-view-generator.
Discover more Laravel packages by tediscript
or browse all Laravel packages to compare alternatives.
Last updated
Laravel module to generate view from artisan command
Run command:
composer require --dev tediscript/laravel-view-generator
Or add this script to your composer.json and run composer update
"require-dev": {
"tediscript/laravel-view-generator": "^1.0.0"
}
Just like you create model via php artisan.
php artisan make:view view-name
It will generate file resources/views/view-name.blade.php using plain.stub template.
php artisan make:view schools.edit --model=School --layout=edit
It will generate file resources/views/schools/edit.blade.php using edit.stub template.
schools.edit is the path name of blade file (just like view name in render)--model=School is the model name. It is optional. Default model name is Item--layout=edit is used to specify the view stub file. The option are create, edit, index, plain, show. The default value is plainYou can create your own stub file inside folder resources/stubs.
For example create file resources/stubs/welcome.stub then you can call artisan command:
php artisan make:view awesome --layout=welcome
It will generate file resources/views/awesome.blade.php using welcome.stub layout.
The supported variable to render are:
{{ model }} we get it from option --model{{ pluralModel }} we get it from pluralize of model{{ resourceName }} we get it from lower case of pluralModel{{ instanceModel }} we get it from camel case of model{{ instanceCollectionModel }} we get it from pluralize of instanceModelThats it.