Awards base class and scaffolding #155

This commit is contained in:
Nabeel Shahzad
2018-03-16 23:59:53 -05:00
parent 067fb0f9f0
commit 7dd6a7e7f3
7 changed files with 161 additions and 12 deletions

View File

@@ -7,6 +7,7 @@ use App\Models\Acars;
use App\Models\Airline;
use App\Models\Pirep;
use App\Models\User;
use App\Services\AwardsService;
use DB;
use PDO;
use Symfony\Component\Yaml\Yaml;
@@ -29,11 +30,12 @@ class DevCommands extends BaseCommand
}
$commands = [
'clear-acars' => 'clearAcars',
'clear-users' => 'clearUsers',
'compile-assets' => 'compileAssets',
'db-attrs' => 'dbAttrs',
'xml-to-yaml' => 'xmlToYaml',
'list-awards' => 'listAwardClasses',
'clear-acars' => 'clearAcars',
'clear-users' => 'clearUsers',
'compile-assets' => 'compileAssets',
'db-attrs' => 'dbAttrs',
'xml-to-yaml' => 'xmlToYaml',
];
if(!array_key_exists($command, $commands)) {
@@ -44,6 +46,23 @@ class DevCommands extends BaseCommand
$this->{$commands[$command]}();
}
/**
* List all award classes
*/
protected function listAwardClasses()
{
$awardSvc = app(AwardsService::class);
$awards = $awardSvc->findAllAwardClasses();
$headers = ['Award Name', 'Class'];
$formatted_awards = [];
foreach($awards as $award) {
$formatted_awards[] = [$award->name, \get_class($award)];
}
$this->table($headers, $formatted_awards);
}
/**
* Delete all the data from the ACARS and PIREP tables
*/