Browse Source

Update package information and readme.md

tags/1.2.2 1.2.1
Nafies Luthfi 7 years ago
parent
commit
2469d3cc5f
  1. 2
      composer.json
  2. 91
      readme.md
  3. BIN
      screenshots/simple-crud-generator-01.jpg
  4. BIN
      screenshots/simple-crud-generator-02.jpg

2
composer.json

@ -1,6 +1,6 @@
{ {
"name": "luthfi/simple-crud-generator", "name": "luthfi/simple-crud-generator",
"description": "A simple CRUD generator for Laravel 5.5 and newer with bootstrap 3.",
"description": "A simple CRUD generator for Laravel 5.5 (and later) with Bootstrap 4.",
"keywords": ["crud-generator", "artisan-command", "laravel-package", "crud", "testing", "tdd-workflow"], "keywords": ["crud-generator", "artisan-command", "laravel-package", "crud", "testing", "tdd-workflow"],
"license": "MIT", "license": "MIT",
"authors": [ "authors": [

91
readme.md

@ -2,11 +2,14 @@
[![Build Status](https://travis-ci.org/nafiesl/SimpleCrudGenerator.svg?branch=master)](https://travis-ci.org/nafiesl/SimpleCrudGenerator) [![Build Status](https://travis-ci.org/nafiesl/SimpleCrudGenerator.svg?branch=master)](https://travis-ci.org/nafiesl/SimpleCrudGenerator)
[![Total Downloads](https://poser.pugx.org/luthfi/simple-crud-generator/downloads)](https://packagist.org/packages/luthfi/simple-crud-generator) [![Total Downloads](https://poser.pugx.org/luthfi/simple-crud-generator/downloads)](https://packagist.org/packages/luthfi/simple-crud-generator)
An artisan `make:crud` command to create a simple CRUD feature on our Laravel 5.5 application. This package is fairly simple, to **boost test-driven development** method on our laravel application.
Need faster TDD in Laravel project? This is a simple CRUD generator complete with automated testing suite.
---
<br>
## About this package ## About this package
This package contains artisan `make:crud` commands to create a simple CRUD feature with test classes on our Laravel 5.5 (and later) application. This package is fairly simple, to **boost test-driven development** method on our laravel application.
With this package installed on local environment, we can use (e.g.) `php artisan make:crud Vehicle` command to generate some files : With this package installed on local environment, we can use (e.g.) `php artisan make:crud Vehicle` command to generate some files :
- `App\Vehicle.php` eloquent model - `App\Vehicle.php` eloquent model
@ -30,11 +33,13 @@ It will also create this file **if it not exists** :
- `resources/lang/app.php` lang file if it not exists - `resources/lang/app.php` lang file if it not exists
- `tests/BrowserKitTest.php` base Feature TestCase class if it not exists - `tests/BrowserKitTest.php` base Feature TestCase class if it not exists
<br>
#### Main purpose #### Main purpose
The main purpose of this package is for faster **Test-driven Development**, it generates model CRUD scaffolds complete with Testing Classes which will use [Laravel Browserkit Testing](https://github.com/laravel/browser-kit-testing) package and [PHPUnit](https://packagist.org/packages/phpunit/phpunit) version 6.
The main purpose of this package is for **faster Test-driven Development**, it generates model CRUD scaffolds complete **with Testing Classes** which will use [Laravel Browserkit Testing](https://github.com/laravel/browser-kit-testing) package and [PHPUnit](https://packagist.org/packages/phpunit/phpunit).
---
<br>
## How to install ## How to install
@ -70,27 +75,10 @@ Luthfi\CrudGenerator\ServiceProvider::class,
'Html' => Collective\Html\HtmlFacade::class, 'Html' => Collective\Html\HtmlFacade::class,
``` ```
---
<br>
## How to use ## How to use
Just type in terminal `$ php artisan` and we will find the `make:crud` command, it will create simple Laravel CRUD files of given **model name**.
#### Available Commands
```bash
# Create Full CRUD feature with tests
$ php artisan make:crud
# Create API CRUD feature with tests
$ php artisan make:crud-api
# Create Simple CRUD feature with tests
$ php artisan make:crud-simple
```
#### Model Attribute/column
The Model and table will **only have 2 pre-definded** attributes or columns : **name** and **description** on each generated model and database table. You can continue working on other column on the table.
Just type in terminal `$ php artisan make:crud ModelName` command, it will create simple Laravel CRUD files of given **model name** completed with tests.
For example we want to create CRUD for '**App\Vehicle**' model. For example we want to create CRUD for '**App\Vehicle**' model.
@ -115,7 +103,7 @@ VehiclePolicyTest (model policy) generated.
CRUD files generated successfully! CRUD files generated successfully!
``` ```
Make sure we have **set our database credential** on `.env` file. Then :
Make sure we have **set database credential** on `.env` file, then :
```bash ```bash
$ php artisan migrate $ php artisan migrate
@ -124,6 +112,47 @@ $ php artisan serve
Then visit our application url: `http://localhost:8000/vehicles`. Then visit our application url: `http://localhost:8000/vehicles`.
<br>
#### Available Commands
```bash
# Create Full CRUD feature with tests
$ php artisan make:crud ModelName
# Create Full CRUD feature with tests and Bootstrap 3 views
$ php artisan make:crud ModelName --bs3
# Create Simple CRUD feature with tests
$ php artisan make:crud-simple ModelName
# Create Simple CRUD feature with tests and Bootstrap 3 views
$ php artisan make:crud-simple ModelName --bs3
# Create API CRUD feature with tests
$ php artisan make:crud-api ModelName
```
<br>
#### Model Attribute/column
The Model and table will **only have 2 pre-definded** attributes or columns : **name** and **description** on each generated model and database table. You can continue working on other column on the table.
<br>
#### Bootstrap 4 Views
The generated view files **use Bootstrap 4 by default** (for Laravel 5.6 and later).
<br>
#### Bootstrap 4 Views
We can also generates views that use Bootstrap 3 with `--bs3` command option, eg for Laravel version 5.5.
<br>
#### For API #### For API
If we want to generate API Controller with feature tests, we use following command : If we want to generate API Controller with feature tests, we use following command :
@ -138,7 +167,7 @@ By default, we use Laravel **Token Based Authentication**, so we need to update
2. Add `api_token` as **fillable** property on **User model**. 2. Add `api_token` as **fillable** property on **User model**.
3. Add `api_token` **field** on our **UserFactory**. 3. Add `api_token` **field** on our **UserFactory**.
---
<br>
## Config file ## Config file
@ -167,14 +196,14 @@ return [
]; ];
``` ```
---
<br>
## Attention ## Attention
- The package will creates the **Model** class file, the command will stop if the **Model already exists**. - The package will creates the **Model** class file, the command will stop if the **Model already exists**.
- **You need** a `resources/views/layouts/app.blade.php` view file, simply create one with `php artisan make:auth` command. You can change this configuration via the `config/simple-crud.php` file. - **You need** a `resources/views/layouts/app.blade.php` view file, simply create one with `php artisan make:auth` command. You can change this configuration via the `config/simple-crud.php` file.
---
<br>
## Screenshots ## Screenshots
@ -182,7 +211,9 @@ Visit your application in new resource route : `http://127.0.0.1:8000/vehicles`
![Generated CRUD page by Simple CRUD Generator](screenshots/simple-crud-generator-01.jpg) ![Generated CRUD page by Simple CRUD Generator](screenshots/simple-crud-generator-01.jpg)
#### Generated testing suite
<br>
## Generated testing suite
Next, let us try the generated testing suite. To use the generated testing classes, we can set the database environment using ***in-memory* database SQLite**. Open `phpunit.xml`. Add two lines below on the `env` : Next, let us try the generated testing suite. To use the generated testing classes, we can set the database environment using ***in-memory* database SQLite**. Open `phpunit.xml`. Add two lines below on the `env` :
@ -207,13 +238,13 @@ All tests should be passed.
![Generated Testing Suite on Simple CRUD Generator](screenshots/simple-crud-generator-02.jpg) ![Generated Testing Suite on Simple CRUD Generator](screenshots/simple-crud-generator-02.jpg)
---
<br>
## Issue/Proposal ## Issue/Proposal
If you find any issue, or want to propose some idea to help this package better, please [create an issue](https://github.com/nafiesl/SimpleCrudGenerator/issues) in this github repo. If you find any issue, or want to propose some idea to help this package better, please [create an issue](https://github.com/nafiesl/SimpleCrudGenerator/issues) in this github repo.
---
<br>
## License ## License

BIN
screenshots/simple-crud-generator-01.jpg

Before

Width: 983  |  Height: 478  |  Size: 44 KiB

After

Width: 990  |  Height: 649  |  Size: 103 KiB

BIN
screenshots/simple-crud-generator-02.jpg

Before

Width: 652  |  Height: 526  |  Size: 76 KiB

After

Width: 652  |  Height: 542  |  Size: 80 KiB

Loading…
Cancel
Save