Is local_things_gps_points
really needed? If I understand your relationship set up, I would think that the relationship is a locale has many gps_points
. Now that I look at it further, I am not even sure locale
is a many-to-many
with things
. Isn't things
just a property of locale
? i.e. locale.thing_type
is a foreign key of things.id
for a one-to-many
of locale
to things
?
Maybe posting some sample data for each table would be useful?
Thanks for reply!
Ex: locale = My Farm (id:1)
things = Barn(id:1), Lake(id:2), House(id:3)
locale_things = Barn A (id:1, locale_id:1, things_id:1), Barn B (id:2, locale_id:1, things_id:1)
locale_things_gps_points = (id:1,locale_things_id:1,sequence:1,latitude:1234,longitude:4321),(id:2,locale_things_id:1,sequence:2,latitude:1111,longitude:2222)
Explaining... a locale (My Farm) could have multiple things (Barn A, Barn B) and each one of these things would have several GPS points. But as you can see these things need to be on a separated table (things), because it will store a lot of common data.
Disregard these weird table names that i used. They aren't the real names of my tables. :D
Thanks for help!
but a single thing
can only belong to a single locale
. correct? i.e. BarnA
can only belong to MyFarm
, right? Or can BarnA
also belong to MyOtherFarm
? If not, it's a one-to-many, not a many-to-many.
Am I reading this wrong?
Sorry m0j0r1s1ng... i don't understand where's my mistake here.
Supposing that a locale (my farm) can have multiple barns, lakes, roads and houses. And this "categories" (houses/lakes/roads/barns) must be on the table "things". So, to "instantiate" a barn to my farm i need to create a link between the locale and the thing (locale_things).
In this context... many locales(farms) can have many things(barns/houses/lakes), and many things(barns/houses/lakes) can be on many locales(farms). Furthermore, to all my "barns instances", for example, i want to save one or more gps points (locale_things_gps_points).
You think i need to change my tables design? Thanks for your patience!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community