How to remove index number from laravel eloquent unique

后端 未结 2 1820
北恋
北恋 2021-01-15 05:31

I am using a query that returns value perfectly but it adds key number to the collection. How can I remove the index number?

Here is the retrieved data



        
2条回答
  •  自闭症患者
    2021-01-15 05:52

    In order to get a collection without a index you have to add the "values" method

    $collection->unique('id')->values();
    

提交回复
热议问题