How in Laravel Model weed out duplicates by the 'test' field, so that only unique entries would be output? Tried through Model :: distinct ('test') -> get (); Does not work.

    1 answer 1

    Try this:

    Model::distinct()->groupBy('test')->get();