Move routes into separate directory
This commit is contained in:
@@ -1,17 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
routesInDirectory();
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Application Routes
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here is where you can register all of the routes for an application.
|
|
||||||
| It's a breeze. Simply tell Laravel the URIs it should respond to
|
|
||||||
| and give it the Closure to execute when that URI is requested.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
Route::get('/', function()
|
function routesInDirectory($app = '') {
|
||||||
{
|
$routeDir = app_path('routes/' . $app . ($app !== '' ? '/' : NULL));
|
||||||
return View::make('hello');
|
$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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
5
app/routes/app.php
Normal file
5
app/routes/app.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
Route::get('/', function() {
|
||||||
|
return View::make('hello');
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user