Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Possible new features I am working on. #115

Open
phillipmadsen opened this issue Oct 7, 2015 · 0 comments
Open

Possible new features I am working on. #115

phillipmadsen opened this issue Oct 7, 2015 · 0 comments

Comments

@phillipmadsen
Copy link
Contributor

EXAMPLE USER CRUD WITH MULIPLE TABLES

[
{
/* (leave this blank if only need one table by default, but if this model needs more then one table add additional table names here) */
      **"database": "InnoDB",**
      **"useAutoIncID": "true",**
      **"useRememberToken": "true",**
      **"useFakerandCreateFactory": "true"**  /* also make --innodb  for the command line ( i will provide a migration generator edit for example )
      "modelTables": "users, password_resets, profiles" */
       /* list all tables this crud/model will use*/
    [
    "tablename": "", //IF LEFT BLANK DEFAULT "USERS" WILL BE CREATED */

            {
                "field":"title:string",
                "type":"text",
                **"inIndexTable": "true",**
                **"FakerField": "words, 4",** /*creates 'title' => $faker->words($nb = 3);
                // other options
                // paragraph, 3 = $faker->paragraph($nbSentences = 3)
                // sentance, 6 = $faker->sentence($nbWords = 6) */

                "validations": "required"
            },
            {
                "field":"body:text",
          /* CHANGE */      **"type":"textarea",** /* ADD NUMBER OF ROWS OPTION */
          /* TO */           **"type":"textarea,3",**  /* {!! Form::textarea('', null, ['class' => 'form-control', 'data-autogrow' => '', 'rows' => '3' ]) !!} */
                "inIndexTable": "false", /* will not be listed in the index table view only on singular id only */
                "FakerField": "paragraph, 4",
                "validations": ""
            },
            {
                "field":"password:string",
                "type":"password",
                **"inIndexTable": "false",**
                **"FakerField": "password",** // creates 'password' => $faker->password,
                "validations": "required"
            },
            {
                "field":"email:string:unique",
                "type":"email",
                **"inIndexTable": "true",**
                **"FakerField": "email",** /* creates 'password' => $faker->password, */
                "validations": ""
            },
            {
                "field":"remember:boolean:default,0",
                "type":"checkbox",
                **"inIndexTable": "true",**
                **"FakerField": "false",** /* checkboxes will be true, false only making   'remember' => false;  in the factory  */
                "validations": ""
            },
            {
                "field":"birth_date:timestamp",
                "type":"date",
                **"inIndexTable": "true",**
                **"FakerField": "date",**/* creates $faker->date($format = 'm-d-Y', $startDate = '-30 years')*/
                "validations": ""
            },
            {
                "field":"last_login:timestamp",
                "type":"date",
                **"inIndexTable": "true",**
                **"FakerField": "dateTime",**/* creates  $faker->dateTime($max = 'now'),*/
                "validations": ""
            }
    ],



    **"database": "InnoDB",**
    **"useAutoIncID": "true",**
    **"useRememberToken": "false",**
    **"useFakerandCreateFactory": "false"**
    [
    **"tablename": "password_resets"**
            {"field": "email:string:nullable", "type": "text", "inIndexTable": "false", "FakerField": "", "validations": ""},
            {"field": "token:string:nullable", "type": "text", "inIndexTable": "false", "FakerField": "" , "validations": ""},
            {"field": "created_at:timestamp", "type": "date", "inIndexTable": "false", "FakerField": "", "validations": ""}
    ],
    **"database": "InnoDB",**
    **"useAutoIncID": "true",**
    **"useRememberToken": "false",**
    **"useFakerandCreateFactory": "false"**

    [
    **"tablename": "user_profile_pivot"**

            {"field": "user_id:integer:unsigned:index", "type":"number", "inIndexTable": "false", "FakerField": "", "validations": ""},
            {"field": "user_id:foreign:references,id:on,users:onDelete,cascade", "type":"select", "inIndexTable": "false", "FakerField": "", "validations": ""},
            {"field": "user_id:integer:unsigned:index", "type":"number", "inIndexTable": "false", "FakerField": "", "validations": ""},
            {"field": "user_id:foreign:references,id:on,users:onDelete,cascade", "type":"select", "inIndexTable": "false", "FakerField": "", "validations": ""},
    ]
}
]

BY DOING IT THIS WAY YOU CAN MAKE THE USER CRUD WITH 3 TABLES INCLUDING PIVOTS AND RELATIONSHIPS.

anyway its a work in progress

what are your thoughts?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant