1.0.49 • Published 5 years ago

grao-laravel-crud v1.0.49

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Grão CLI (Crud for Laravel)

A CLI for creating basic files for Laravel

  • Creation of migrations.
  • Creation of controllers.
  • Creation of models.
  • Creation of views.
  • All in few commands =).

Usage (Install global)


$ npm i -g grao-laravel-crud

New Features!


  • Standard version of Laravel Crud
  • composer dumpautoload after the generate.

Usage (CLI) Generate


This command generates the Controllers, Model and Views files. When reusing the same table_name it overwrites the previous file. We use the template files created in the project in the grao-config folder.

Files in the config folder.

filesdescription
controller.js.ejsModel for modifiable Controller generation for laravel
model.js.ejsModel for modifiable Models generation for laravel
routes.js.ejsModel for modifiable Routes generation for laravel
index.js.ejsTemplate for generating list page modifiable for laravel
edit.js.ejsTemplate for form generation modifiable for laravel
show.js.ejsTemplate for data visualization

Before running the command, the table in the database should exist.

IMPORTANT: This module only uses MYSQL connection, reading the .env file. You can use the CLI migrations generator.

COMMAND:

$ grao g table_name namespace 

or

$ grao generate table_name namespace
paramsdescription
table_nameThe name of the database table
namespaceThe name of the Workspace / Namespace in Laravel

Folder grao-config (CLI)


If you want to change something in the next 'crud', the grao-config folder will be created in your directory with .ejs files for modifications, any modification to these files will affect the generation of the crud`s files in the application. If you want to re-create the folder just delete it and the files will come in the default.

Or you can use the command below in laravel project. He had erased and recreated the folder:

$ grao reset

or

$ grao r

routes.php


Path: grao-config/routes.php

This file adds the routes generated by the commands, always at the end of the file.

Copy and paste into your Laravel route file.


Usage (CLI) Migrations


  • ATTENTION: This feature supports only Mysql database

The migration system generates two files, one for creation and one for updating. These files are generated in database/migrations/create and database/migrations/update

The file inside database/migrations/create will create the tables in the database to be used in the rollback and creation. The update file inside database/migrations/update will only serve to modify the database table. --update

To generate these files use the command below:

$ grao migrate table_name --fields="field1:string, field2:string, field3:text, field4:int, field1:bigInteger"

obs: The file already comes with the autoincrement id.

paramsdescription
table_nameThe name of the database table
--fieldsName the fields with their types separated by a colon.

Go to the file make the necessary modifications and then execute the commands below to create the table in the database:

$ grao migrate table_name --run

We can update a migration. The update file is in database/migrations/update/table_name:

$ grao migrate table_name --update

We can also run specific rollback with the command below:

$ grao migrate table_name --rollback

If you want you can run all created migrations.

$ grao migrate --run

We can rollback all migrations.

$ grao migrate --rollback
paramsdescription
table_nameThe name of the database table
runCommand to create
rollbackCommand to return
updateCommand to update the table

=)


  • Donations to always improve the project, thank you.
  • PayPal: sueltonlima@gmail.com

License

MIT - see LICENSE

1.0.49

5 years ago

1.0.48

5 years ago

1.0.47

5 years ago

1.0.46

5 years ago

1.0.45

5 years ago

1.0.44

5 years ago

1.0.43

5 years ago

1.0.42

5 years ago

1.0.41

5 years ago

1.0.40

5 years ago

1.0.39

5 years ago

1.0.38

5 years ago

1.0.37

5 years ago

1.0.36

5 years ago

1.0.35

5 years ago

1.0.33

5 years ago

1.0.32

5 years ago

1.0.31

5 years ago

1.0.30

5 years ago

1.0.29

5 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago