Package Data | |
---|---|
Maintainer Username: | joshralph93 |
Maintainer Contact: | joshralph93@gmail.com (Josh Ralph) |
Package Create Date: | 2017-01-28 |
Package Last Update: | 2017-02-10 |
Home Page: | |
Language: | PHP |
License: | Unknown |
Last Refreshed: | 2024-11-23 03:15:05 |
Package Statistics | |
---|---|
Total Downloads: | 193 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 2 |
Total Forks: | 1 |
Total Open Issues: | 1 |
Only currently actively tested with Laravel 5.4. Previous version support to come...
Contribution welcome.
Pull in the package using composer
$ composer require joshralph/quick-gen "dev-master" --dev
Include the service provider within /config/app.php
QuickGen\Providers\GeneratorServiceProvider::class,
You will need to run the command below to publish the stub files that ship with the package.
php artisan vendor:publish --tag=stubs
To run the generator run the below command. The example resource name given below should be replaced as you need.
php artisan quick-gen:generate cars
The package ships with a standard CRUD template that you can use to generate basic CRUD functionality.
To specify which template you wish to use, add the template flag to the command.
This template will generate the following files for you within the standard laravel directory structure:
Of course you will likely want to create your own template files that are in keeping with your current view structure, and coding style.
To create a new template simply create a new folder within the resources/stubs/
directory. The folder name should be used when setting the --template
argument.
You can then call the command below using the --template
argument
php artisan quick-gen:generate cars --template=my-template
Note all stub files should end in .stub
The following variables are made available to stub files (both content and filename):
name
- The name of the resource as specified in the generate command
baseNamespace
- The namespace where the generated files will reside.
...and should be wrapped in the following way:
Stub Contents
namespace <<baseNamespace>>\Http\Controllers\Admin;
Filename
__name__Controller.php.stub
You may wish to transform the case and formatting of variables within stub files. These can be used both within the file contents and the filename.
Filters can be added to variables using a .
delimiter.
@foreach ($<<name.camel.plural>> as $<<name.camel.singular>>)
<tr>
<td>{{ $<<name.camel.singular>>->name }}</td>
</tr>
@endforeach
The following filters are available:
camel
- convert the variable to camel case.
studly
- convert the variable to studly case.
snake
- convert the variable to snake case.
plural
- convert the variable to plural.
singular
- convert the variable to singular.
lower
- convert the variable to lowercase.
ucwords
- upper case the first letter of each word in the variable (see words
).
words
- convert the variable to space delimited words
| Verb | Name | Method | |------|-------------------------------|---------------| | GET | <<name.snake.plural>>.index | @index | | GET | <<name.snake.plural>>.create | @create | | POST | <<name.snake.plural>>.store | @store | | GET | <<name.snake.plural>>.edit | @edit($id) | | POST | <<name.snake.plural>>.update | @update($id) | | GET | <<name.snake.plural>>.destroy | @destroy($id) |