5分でできる laravel CRUD-d アプリケーション(dogears/CrudDscaffold パッケージのすすめ)

I have developed a package to generate a basic CRUD-d application in laravel. This article introduct how to use.

■dog-ears/crud-d-scaffold
https://packagist.org/packages/dog-ears/crud-d-scaffold

As following the specification of an application to be created

(i) Create(C)、Show(R)、Update(U)、Delete(D)and, You can Duplicate items(d).
(ii) At the index page, you can search for a word, and the range specified. Multipleconditions are also possible.

let’s do it.


[Preparation]
・laravel v5.2
・laravelcollective/html package

First, We finish that installation.

■Install

(i) Add package to require-dev in composer.json.
and composer update.

#/composer.json
"require-dev": {
"dog-ears/crud-d-scaffold": "1.*"
}

At this point, three minutes.

(ii)Adding a service provider

#/config/app.php
'providers' => [
dogears\CrudDscaffold\GeneratorsServiceProvider::class,
]

(iii) Run the Artisan, sure it is installed.

When you run the php artisan, the following command has been added.

- 'make:scaffold' : スキャフォールド アプリ作成
- 'delete:scaffold' : スキャフォールド アプリ削除
- 'make:relation' : 1対多関係作成
- 'delete:relation' : 1対多関係削除

■Create Application

(i) Publish HTML resources

php artisan vendor:publish --tag=public --force

(ii) Create [AppleType] Model and [Apple] Model

php artisan make:scaffold AppleType --schema="name:string" --seeding
php artisan make:scaffold Apple --schema="name:string,apple_type_id:integer:unsigned" --seeding

(iii) Migration and Seeding

php artisan migrate
php artisan db:seed

(iv) Connect [AppleType]Model to [Apple] Model in a one-to-many relationship.

php artisan make:relation AppleType Apple

We now have two applications.
Preview your application in [/apples/] or [/apple]

By the way, how to delete, as follows.

(i) Delete relationships

php artisan delete:relation AppleType Apple

(ii) Delete application

php artisan delete:scaffold AppleType
php artisan delete:scaffold Apple

It should be noted, and the migration file,
For those that use a common each application, it will not be deleted.
If necessary, please delete manually.

Or more, it is the introduction of a simple package.
For detailed functionality, I will write the times again.

If you notice something wrong point, I am glad to hear it.
Thank you.

[Capture Image]

cap01
cap02
cap03