Download the PHP package timwassenburg/laravel-improved-resource-controllers without Composer
On this page you can find all versions of the php package timwassenburg/laravel-improved-resource-controllers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download timwassenburg/laravel-improved-resource-controllers
More information about timwassenburg/laravel-improved-resource-controllers
Files in timwassenburg/laravel-improved-resource-controllers
Package laravel-improved-resource-controllers
Short Description Generate complete resource controllers
License MIT
Homepage https://github.com/timwassenburg/laravel-improved-resource-controllers
Informations about the package laravel-improved-resource-controllers
Table of Contents
- Features
-
Getting started
- Installation
- Publish config (optional)
- Publish stubs (optional)
-
Usage
- Default resource controller
- Default API resource controller
- Model resource controller
- Model API resource controller
- Nested resource controller
- Nested API resource controller
-
Variables
- General
- With parent (--parent=Customer)
- More generator packages
- Contributing
- License
Features
This simple package extends the command and generates resource controllers with working resource functions out of the box to prevent you from writing the same basic controller functions over and over again. Keep in mind the improved resource controllers are only meant as a starting point. You still have to add your own routes, validation, migrations, etc.
Getting started
Installation
Require the package with composer.
Publish config (optional)
Publish stubs (optional)
To change the generated resource controllers you can override the stubs and adjust it to your liking. The stubs will be stored in /resources/stubs.
Usage
The idea behind this package is that you can keep using the make:controller commands you are already used to. So no need to change your muscle memory. Checkout the example output to see the result for each command.
Default resource controller
Default API resource controller
Model resource controller
Model API resource controller
Nested resource controller
Nested API resource controller
Variables
In the stubs you can use the following variables.
General
Variable | Output |
---|---|
{{ namespace }} | App\Http\Controllers |
{{ namespacedModel }} | App\Models\Order |
{{ class }} | OrderController |
{{ model }} | Order |
{{ modelVariable }} | order |
{{ modelVariablePlural }} | orders |
With parent (--parent=Customer)
Variable | Output |
---|---|
{{ namespacedParentModel }} | App\Models\Customer |
{{ parentModelVariable }} | customer |
{{ parentModelVariablePlural }} | customers |
More generator packages
Looking for more ways to speed up your workflow? Make sure to check out these packages.
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
The MIT License (MIT). Please see License File for more information.