public function getModules() { if (isset(static::$modules)) { return static::$modules; } // $modules = $this->config->get('modules.modules', array()); $modules = array_map(function ($slug, $properties) { $autoload = array('config', 'events', 'filters', 'routes'); $options = array_get($properties, 'autoload', array()); if (!empty($options)) { $autoload = array_intersect($options, $autoload); } array_push($autoload, 'bootstrap'); // $namespace = isset($properties['namespace']) ? $properties['namespace'] : Str::studly($slug); return array_merge(array('slug' => $slug, 'name' => isset($properties['name']) ? $properties['name'] : $namespace, 'namespace' => $namespace, 'enabled' => isset($properties['enabled']) ? $properties['enabled'] : true, 'order' => isset($properties['order']) ? $properties['order'] : 9001, 'autoload' => $autoload), $properties); }, array_keys($modules), $modules); return static::$modules = Collection::make($modules)->sortBy('order'); }
/** * Create a collection from the given value. * * @param mixed $value * @return \Nova\Support\Collection */ function collect($value = null) { return Collection::make($value); }
/** * Gather all of the foreign keys for a given type. * * @param string $type * @return array */ protected function gatherKeysByType($type) { $foreign = $this->foreignKey; return BaseCollection::make($this->dictionary[$type])->map(function ($models) use($foreign) { return head($models)->{$foreign}; })->unique(); }