Are you missing a collectable or collectables class?
I don't have a collectable or collectables class, but then what would be the relationship between the collectable class and all other classes?
See if by chance this helps:
http://laravel.io/forum/05-28-2014-how-to-add-data-to-many-to-many-polymorphic-relation?page=1
Okay, the problem was not the way the I modeled the relationships... Somehow
Animal::find(2)->first()->id; // returns 1
always returns a DB row with ID 1 instead of a DB row with ID $key. I'm still puzzled why, because
Animal::where('id', 2)->first()->id; // return 2
So, technically this issue is solved and will mark it as solved, but I still can't explain this behavior.
EDIT: Okay, after digging around in the Laravel code, the find() method already uses the first() method and thus a second first() method after find() will screw up the result. "Mystery" solved...
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community