guys.
I have a table in which there are rows with specific columns with duplicated values. It happened because of a merging of the same table from different sources. I know I can use unique()
to eliminate duplicates from a collection, but I need to go a bit further. All duplicated rows (each pair) have in one row a cloumn true and the other false. I want to always delete the one with false but I haven't found a way for that. I know I can choose which columns to compare with unique()
to find duplicates, but I don't know if it's possible to pick the ones being deleted, like if I used unique()->where('active', true)
.
Thanks in advance.
source https://stackoverflow.com/questions/70128334/choose-which-duplicate-to-remove-from-collection-with-laravel
Comments
Post a Comment