phpvms/app/Services/AwardsService.php

31 lines
700 B
PHP
Raw Normal View History

2018-03-17 12:59:53 +08:00
<?php
namespace App\Services;
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 = [];
# 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');
$classes = ClassLoader::getClassesInPath($path);
$awards = array_merge($awards, $classes);
2018-03-17 12:59:53 +08:00
}
return $awards;
}
}