I'm new user of Laravel 5.2
For example i have data rows something like this:
mytable
-------------------------------
url | ip
-------------------------------
google.com | 11.44.180.149 <-----
msn.com | 11.44.180.149
google.com | 11.44.180.149 <-----
yahoo.com | 11.44.180.149
google.com | 11.44.180.149 <-----
I want select all rows that 2 or 3 columns value their is equal and delete rows equal that it's more than one
For example convert to this:
mytable
-------------------------------
url | ip
-------------------------------
google.com | 11.44.180.149 <-----
msn.com | 11.44.180.149
yahoo.com | 11.44.180.149
Guys i'm so sorry because can't speak English very well.
Thank you
You can use groupBy() method with Eloquent:
MyTable::groupBy('ip')->get();
Or query builder:
DB::table('mytable')->groupBy('ip')->get();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With