Cachet/app/routes.php

18 lines
456 B
PHP
Raw Normal View History

2014-11-16 22:26:08 +00:00
<?php
2014-11-16 23:00:37 +00:00
routesInDirectory();
2014-11-16 22:26:08 +00:00
2014-11-16 23:00:37 +00:00
function routesInDirectory($app = '') {
$routeDir = app_path('routes/' . $app . ($app !== '' ? '/' : NULL));
$iterator = new RecursiveDirectoryIterator($routeDir);
$iterator->setFlags(RecursiveDirectoryIterator::SKIP_DOTS);
foreach ($iterator as $route) {
$isDotFile = strpos($route->getFilename(), '.') === 0;
if (!$isDotFile && !$route->isDir()) {
require $routeDir . $route->getFilename();
}
}
}