for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Traits;
use Closure;
trait ArrayTrait {
protected function makeArrayWithKeys(array $array, Closure $idFunc) {
$result = [ ];
foreach($array as $item) {
$result[$idFunc($item)] = $item;
}
return $result;