mercredi 7 février 2018

Laravel 5 model method for a one-to-many where the many table uses the primary key more than two times

I have one table called gen_nodes, which is a root table in that it has an id, fields for name and description, and each row is not dependent on another value.

I also have a table called gen_nodes_hierarchy which has three columns:

parent_node_id   (required)
child_node_id    (required)
group_node_id    (default NULL, optional)

Where the values in gen_nodes.id will reside.

To give an overview of use, these two tables are for defining complex taxonomic relationships including menu hierarchies.

I am new to this area of Laravel (5.5). What is the proper way to set up the model(s) for these tables, and what properties need to be declared in each model to make this work? Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire