Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Laravel 集合唯一方法现在在键组成期间适用于数组
$a = [ ['contact.name' => 'abc'], .... ];
当我尝试对其调用唯一方法时contact.name,仅返回一项
contact.name
找到了
使用闭包函数
collect($contacts)->unique(function($contact) { return $contact['contact.name']; })->values()->all();