【update history】 crud-d-scaffold v2.5.1 – Add many-to-many relationship(2017.11.02)

Hello.
I’m dog-ears.

I added a many to many relationship to crud-d-scaffold,
I will introduce you.

■github – dog-ears/crud-d-scaffold
https://github.com/dog-ears/crud-d-scaffold

Many to many relationships are added to crud-d-scaffold.json,
Just by adding information on the pivot table, you can easily make it.

————————————————–
crud-d-scaffold.json
————————————————–

{
 "app_type": "web", /* [default:web] */ <- Currently, only 'web' is acceptable
 "use_laravel_auth": "false", /* [default:false] */ <- If you want use laravel auth, set "true"
 "models": [
 {
 "name": "jointAuthor", /* [required] format[nameName] */ <- Name of model
 "display_name": "JOINT AUTHOR", /* [required] */ <- Display name of the model
 "schemas": [
 {
 "name": "realName", /* [required] */ <- Column name (In the case of relation, make it model name _id)
 "type": "string", /* [default:string] ex( integer, string ) */ <- Column type
 "input_type": "text", /* [default:text] text, textarea */ /* relation_column forced to pulldown */
 "faker_type": "name()", /* [default -> no seeding] ex( randomDigit(), randomNumber(2), numberBetween(1,30), word(), sentence(), paragraph(), text(), name(), address(), date('Y-m-d','now'), safeEmail(), password() ) */ <- seed faker type (If not, it is generated by '' (please make nullable "true") )
 "nullable": "false", /* [default:false] ex( true, false ) */ <- Whether null is allowed or not
 "display_name": "REAL NAME",/* [required] */ <- Display name
 "show_in_list": "true", /* [default:true] ex( true, false ) */ <- Whether to display on the list page
 "show_in_detail": "true", /* [default:true] ex( true, false ) */ <- Whether to display on the detail page
 "belongsto": "", /* [default:""] */ <- Target model to belongsto
 "belongsto_column": "" /* [default:""] */ <- Column name of target model to be displayed in relation column
 },{
...
 }
 ],
 "pivots":[
 {
 "parentModel":"user", /* Parent model name */
 "parentModel_column":"name", /* This column value is displayed in child model index, create and edit page */
 "childModel":"specialLicense", /* Child model name */
 "childModel_column":"licenseName", /* This column value is displayed in parent model index, create and edit page */
 "use_soft_delete": "false",
 "schemas": [ /* same with model schemas */
 {
 "name":"proficiency",
 "type":"integer",
 "input_type": "text",
 "faker_type": "numberBetween(1,10)",
 "nullable": "true",
 "display_name": "PROFICIENCY"
 }
 ]
 },
...

If you want to actually use it please try the sample data in the following way.
————————————————–
How to installation and execution
————————————————–

Step1:Installing package

composer require dog-ears/crud-d-scaffold

Step2:Run Artisan!

php artisan

When executed, the following commands have been added.

- 'crud-d-scaffold:setup' : Setup crud-d-scaffold with bootstrap 3

This completes the preparation.
Let’s register the sample.

(i) Public resources

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

(ii) Copy crud-d-scaffold.json.sample in package to laravel project root. and rename it.

cp ./vendor/dog-ears/crud-d-scaffold/crud-d-scaffold.json.sample ./crud-d-scaffold.json

(iii) run crud-d-scaffold:setup

php artisan crud-d-scaffold:setup -f

Overwriting the file with -f option.
For the first time, the f option is unnecessary. (No problem with putting on)

(iv) run migration and seeding

php artisan migrate
php artisan db:seed

It’s all over.
Please check your application.
If you want to modify the application structure,
After running [migrate: reset], delete the migration file (/ database / migrations /) and then
execute [ Crud-d-scaffold: setup-f ]

Feedback, bug reports, etc.
If you have something, I’m happy to get in touch with you.

see you

Leave a Reply

Your email address will not be published. Required fields are marked *