Created
January 15, 2015 20:56
-
-
Save 0xMatt/1448b59bca70963166b4 to your computer and use it in GitHub Desktop.
RouteServiceProvider
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Lithe\Routing; | |
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; | |
class RouteServiceProvider extends ServiceProvider | |
{ | |
/** | |
* | |
* @var boolean | |
*/ | |
protected $scanWhenLocal = true; | |
/** | |
*/ | |
public function map() | |
{ | |
if ($this->scanWhenLocal && $this->app->environment('local') || ! file_Exists(app_path('Http/routes.php'))) { | |
$this->scan(); | |
} | |
$this->load(); | |
} | |
/** | |
*/ | |
protected function scan() | |
{ | |
$scanner = new Scanner($this->app['modules'], $this->app['Modules\System\Domain\Page\PageRepository']); | |
file_put_contents(app_path('Http/routes.php'), '<?php ' . $scanner->definitions()); | |
} | |
/** | |
*/ | |
protected function load() | |
{ | |
if (file_exists(storage_path('framework') . '/routes.php')) { | |
return; | |
} | |
require_once app_path('Http/routes.php'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment