mwi/laravel-crud

MWI Crud setup for Laravel Projects

3.2.2 2019-10-16 15:33 UTC

This package is auto-updated.

Last update: 2024-05-17 01:51:57 UTC


README

We have put together a CRUD command. It will set up all the core files necessary to create a well put together CRUD. Routes and Views will need to be added separately given the complexity of some applications.

The files included are:

  • model
  • controller
  • API controller
  • handler (service)
  • policy
  • request
  • management (trait for additional route method)
  • helpers (trait for manipulating data)
  • transformer (for fractal with API)
  • views (basic crud views)
  • tests (feature and unit examples)

For command help

$ php artisan -h make:crud

Required Arguments

First argument is the name of the model. Second Argument is the plural version.

$ php artisan make:crud SalesTerritory SalesTerritories

Migration

By default this command will also create a migration for the new model. If you'd prefer to not create the migration use the --no-migration option.

$ php artisan make:crud SalesTerritory SalesTerritories --no-migration

Specific Resources

By default the command will create all of the resources available. If you only need a few resources you may use the --with option. This will prompt for you to specify which resources you need.

$ php artisan make:crud SalesTerritory SalesTerritories --with

API Resources

If you wish to create the resources for an API you may use the --api option. This will generate a base ApiController if one does not exist along with an api specific controller on top of the normal controller for the model.

$ php artisan make:crud SalesTerritory SalesTerritories --api

All of these options may be used in conjunction with one another to produce the desired resources.