npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grao-laravel-crud

v1.0.49

Published

Generator Migrations, Controler, Model, View, Routes for Laravel via CLI

Downloads

63

Readme

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.

| files | description | | ------ | ------ | | controller.js.ejs | Model for modifiable Controller generation for laravel | | model.js.ejs | Model for modifiable Models generation for laravel | | routes.js.ejs | Model for modifiable Routes generation for laravel | | index.js.ejs | Template for generating list page modifiable for laravel | | edit.js.ejs | Template for form generation modifiable for laravel | | show.js.ejs | Template 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

| params | description | | ------ | ------ | | table_name | The name of the database table | | namespace | The 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.

| params | description | | ------ | ------ | | table_name | The name of the database table | | --fields | Name 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

| params | description | | ------ | ------ | | table_name | The name of the database table | | run | Command to create | | rollback | Command to return | | update | Command to update the table |


=)



License

MIT - see LICENSE