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
I realised that if you want to merge two collections like this:
$collection1->merge($collection2)
You will get an exception saying that you haven't implemented a getKey() method. After som digging around, I found that, as long as you implement this method on the model and return something unique for each model instance, the merge will work.
I guess my tip is that the getKey() method is implemented in the Model.php file and that the developers using this package can provide an id attribute which is unique for all model instances :)
The text was updated successfully, but these errors were encountered:
I realised that if you want to merge two collections like this:
You will get an exception saying that you haven't implemented a getKey() method. After som digging around, I found that, as long as you implement this method on the model and return something unique for each model instance, the merge will work.
I guess my tip is that the getKey() method is implemented in the Model.php file and that the developers using this package can provide an id attribute which is unique for all model instances :)
The text was updated successfully, but these errors were encountered: