Account for fuel in the finance calculations #313

This commit is contained in:
Nabeel Shahzad
2019-07-23 08:41:20 -04:00
parent ee1c8ee3fa
commit 62a10224a0
31 changed files with 246 additions and 89 deletions

View File

@@ -28,6 +28,7 @@ class MigrationService extends Service
public function syncAllSeeds(): void
{
$this->syncAllSettings();
$this->syncAllPermissions();
}
public function syncAllSettings(): void
@@ -43,6 +44,22 @@ class MigrationService extends Service
}
}
public function syncAllPermissions(): void
{
$data = file_get_contents(database_path('/seeds/permissions.yml'));
$yml = Yaml::parse($data);
foreach ($yml as $perm) {
$count = DB::table('permissions')->where('name', $perm['name'])->count('name');
if ($count === 0) {
DB::table('permissions')->insert($perm);
} else {
DB::table('settings')
->where('name', $perm['name'])
->update($perm);
}
}
}
/**
* @param $key
* @param $attrs