HowTo create model relations?


After you have seen this HowTo video and read this article you will know how model relations are created and how you can connect certain data to other data in your application.

Step 01
Click on 'datamodel' in the Builder Menu left.

Step 02
Hover at the model which you would like to connect with anohter model.

Step 03
Click on the '+' in the header. Drag and drop the line to the other model.

Step 04
The model relation settings appears. Select between the three types of model relations: Has_many, Belongs_to, and Has and Belongs to many.

Step 05
Click 'Save' and the selected relation is created.

Step 06
Notice that every model relation is shown in both models. Example: if you've created a relation that One Customer holds multiple Invoices, you will now see Customer in the Invoice model and Invoices in the Customer model.

Step 07
Notice that relations also could be created via the model settings. Click on a model and the model settings apears. Clikc on the subview 'Relations' and click 'New'. Select the relation type and which model you would like to connect with the one you have selected previously. Click 'Save' and the relation is created.


Didn’t find what you want?Ask your question on the forum!