2018-03-17 12:59:53 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Services;
|
|
|
|
|
2018-03-17 13:55:39 +08:00
|
|
|
use App\Support\ClassLoader;
|
2018-03-17 12:59:53 +08:00
|
|
|
use Module;
|
|
|
|
|
|
|
|
class AwardsService
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Find any of the award classes
|
|
|
|
*/
|
|
|
|
public function findAllAwardClasses()
|
|
|
|
{
|
|
|
|
$awards = [];
|
2018-03-17 13:55:39 +08:00
|
|
|
|
|
|
|
# Find the awards in the app/Awards directory
|
|
|
|
$classes = ClassLoader::getClassesInPath(app_path('/Awards'));
|
|
|
|
$awards = array_merge($awards, $classes);
|
|
|
|
|
|
|
|
# Look throughout all the other modules
|
2018-03-17 12:59:53 +08:00
|
|
|
foreach (Module::all() as $module) {
|
|
|
|
$path = $module->getExtraPath('Awards');
|
2018-03-17 13:55:39 +08:00
|
|
|
$classes = ClassLoader::getClassesInPath($path);
|
|
|
|
$awards = array_merge($awards, $classes);
|
2018-03-17 12:59:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return $awards;
|
|
|
|
}
|
|
|
|
}
|