/** * Filter directory contents by type. * * @param array $contents * @param string $type * * @return array */ protected function filterContentsByType($contents, $type) { return Collection::make($contents)->where('type', $type)->pluck('path')->values()->all(); }
/** * Sort the array using the given callback. * * @param array $array * @param callable $callback * * @return array */ public static function sort($array, callable $callback) { return Collection::make($array)->sortBy($callback)->all(); }