public getOrdered ( string $direction = 'asc' ) : array | ||
$direction | string | |
리턴 | array |
public function getOrdered($direction = 'asc')
{
$modules = $this->enabled();
uasort($modules, function (Module $a, Module $b) use($direction) {
if ($a->order == $b->order) {
return 0;
}
if ($direction == 'desc') {
return $a->order < $b->order ? 1 : -1;
}
return $a->order > $b->order ? 1 : -1;
});
return $modules;
}
/** * Execute the console command. * * @return mixed */ public function fire() { $this->module = $this->laravel['modules']; $name = $this->argument('module'); if ($name) { $module = $this->module->findOrFail($name); return $this->migrate($module); } foreach ($this->module->getOrdered($this->option('direction')) as $module) { $this->line('Running for module: <info>' . $module->getName() . '</info>'); $this->migrate($module); } }