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

@@ -0,0 +1,31 @@
<?php
namespace App\Services;
use Module;
use Symfony\Component\ClassLoader\ClassMapGenerator;
class AwardsService
{
/**
* Find any of the award classes
*/
public function findAllAwardClasses()
{
$awards = [];
foreach (Module::all() as $module) {
$path = $module->getExtraPath('Awards');
if(!file_exists($path)) {
continue;
}
$classes = array_keys(ClassMapGenerator::createMap($path));
foreach($classes as $cl) {
$klass = new $cl;
$awards[] = $klass;
}
}
return $awards;
}
}