Models and Tables


You can add Models and Tables on the Schema Editor. Each Schema Entity supports the majority of Laravel Migrations field types. Model entities also support adding relationships.


Schema

Creating

To create a new entity, you can click on the Add Entity button on the Schema Editor. Then, on the Add Entity modal, fill all the obligatory fields.


image


If you choose to add a Model entity, Vemto will suggest the Model Collection name and the Model Table name using the following rules:

  • Collection - The collection name, by default, is the English plural of the Model name. For example, for a model named "User", the collection will be "Users" by default
  • Table - The table name, by default, is the English plural of the Model name, in lower case. For example, for a model named "User", the table will be "users" by default

{warning} It is highly recommended to follow the Eloquent Model Conventions when creating models and tables


However, you can change the Collection and Table names if necessary (for example, if you are not creating a Model with an English name).

{warning} It is recommended to always use English when creating your models, fields, and relationships. If you choose to create a model that doesn't have an English name, be sure to enable the Inline Routes mode on Project Settings, or manually edit the routes resources, as you can see here on Laravel Documentation.

The default Vemto nomenclature for Models follows all Laravel nomenclature standards. Vemto also detects when you are using non-standard nomenclature and correctly generates the code with the recommended Laravel practices for these cases (except for the routes, that need to be changed to Inline mode).

Updating

To update an entity, just fire a "fast click" on it to open the Entity Options panel (you can use a "click + drag" to move the Entity through the Schema Editor area)


image

To see how to add fields to the Model or Table, please check the Fields documentation.

Pivot Tables

Please check the Relationships Instructions for Pivot Tables