Style fixes

This commit is contained in:
Nabeel Shahzad
2019-04-07 19:23:44 -05:00
parent 93b738be79
commit ec662243d8

View File

@@ -9,10 +9,6 @@ use Log;
use Nwidart\Modules\Facades\Module; use Nwidart\Modules\Facades\Module;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
/**
* Class MigrationsService
* @package Modules\Installer\Services
*/
class MigrationService extends Service class MigrationService extends Service
{ {
private $counters = []; private $counters = [];
@@ -33,7 +29,8 @@ class MigrationService extends Service
$this->syncAllSettings(); $this->syncAllSettings();
} }
public function syncAllSettings(): void { public function syncAllSettings(): void
{
$data = file_get_contents(database_path('/seeds/settings.yml')); $data = file_get_contents(database_path('/seeds/settings.yml'));
$yml = Yaml::parse($data); $yml = Yaml::parse($data);
foreach ($yml as $setting) { foreach ($yml as $setting) {
@@ -100,7 +97,7 @@ class MigrationService extends Service
->first(); ->first();
if ($group === null) { if ($group === null) {
$offset = (int)DB::table('settings')->max('offset'); $offset = (int) DB::table('settings')->max('offset');
if ($offset === null) { if ($offset === null) {
$offset = 0; $offset = 0;
$start_offset = 1; $start_offset = 1;
@@ -110,7 +107,7 @@ class MigrationService extends Service
} }
} else { } else {
// Now find the number to start from // Now find the number to start from
$start_offset = (int)DB::table('settings')->where('group', $name)->max('order'); $start_offset = (int) DB::table('settings')->where('group', $name)->max('order');
if ($start_offset === null) { if ($start_offset === null) {
$start_offset = $offset + 1; $start_offset = $offset + 1;
} else { } else {
@@ -147,17 +144,18 @@ class MigrationService extends Service
/** /**
* Find all of the possible paths that migrations exist. * Find all of the possible paths that migrations exist.
* Include looking in all of the modules Database/migrations directories * Include looking in all of the modules Database/migrations directories
*
* @return array * @return array
*/ */
public function getMigrationPaths(): array public function getMigrationPaths(): array
{ {
$paths = [ $paths = [
'core' => \App::databasePath() . '/migrations' 'core' => \App::databasePath().'/migrations'
]; ];
$modules = Module::allEnabled(); $modules = Module::allEnabled();
foreach ($modules as $module) { foreach ($modules as $module) {
$module_path = $module->getPath() . '/Database/migrations'; $module_path = $module->getPath().'/Database/migrations';
if(file_exists($module_path)) { if(file_exists($module_path)) {
$paths[$module->getName()] = $module_path; $paths[$module->getName()] = $module_path;
} }