You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This looks like an amazing library and exactly what I need. However, I've literally read the examples 50 times trying to figure out how to accomplish what I need, but I just can't understand it. First of all, does this library work for my situation? And if so, what is the proper relationship definition?
I am trying to set up a stockableItems relationship on the Product model.
I can not for the life of me figure out the right way to do this. Can anyone help? Here is something I tried, using the advanced hasManyDeepFromRelations method:
public function stockableItems() {
return $this->hasManyDeepFromRelations(
$this->ssin(),
(new Ssin)->stockableItems()
);
}
This seemed to work, but then I noticed that when I retrieved $product->stockableItems, the stockableItems were actually being returned with the wrong ID. For some reason they were being assigned an ID equal to the ssin_id from the ssin_stockable_item join table.
I'm not sure if this is a bug or if my setup is wrong. Also, I probably don't even need to use the hasManyDeepFromRelations method, but as stated above, I can't figure out from the documentation how this relationship is supposed to be set up.
The text was updated successfully, but these errors were encountered:
There's a limitation in the underlying HasManyThrough relationship that causes the issue with incorrects IDs when the first segment is a BelongsTo relationship.
This looks like an amazing library and exactly what I need. However, I've literally read the examples 50 times trying to figure out how to accomplish what I need, but I just can't understand it. First of all, does this library work for my situation? And if so, what is the proper relationship definition?
I'm have the following relationship:
Product -> belongsTo -> SSIN -> belongsToMany -> stockableItems
I am trying to set up a
stockableItems
relationship on theProduct
model.I can not for the life of me figure out the right way to do this. Can anyone help? Here is something I tried, using the advanced
hasManyDeepFromRelations
method:This seemed to work, but then I noticed that when I retrieved
$product->stockableItems
, the stockableItems were actually being returned with the wrong ID. For some reason they were being assigned an ID equal to thessin_id
from thessin_stockable_item
join table.I'm not sure if this is a bug or if my setup is wrong. Also, I probably don't even need to use the
hasManyDeepFromRelations
method, but as stated above, I can't figure out from the documentation how this relationship is supposed to be set up.The text was updated successfully, but these errors were encountered: