Skip to content

Commit

Permalink
Merge pull request #5 from liangjunmo/master
Browse files Browse the repository at this point in the history
注册路由前,判断是否为Lumen
  • Loading branch information
jormin authored Dec 25, 2017
2 parents 2593179 + 1967e6d commit c98620e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/DDocServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public function boot()
__DIR__.'/../public/' => public_path(''),
]);
// 注册路由
if (! $this->app->routesAreCached()) {
if ((method_exists($this->app, 'routesAreCached') && !$this->app->routesAreCached())
|| $this->isLumen()) {
require __DIR__.'/routes.php';
}
}
Expand All @@ -43,4 +44,9 @@ public function register()
{
$this->app->register('Barryvdh\Snappy\ServiceProvider');
}
}

protected function isLumen()
{
return strpos($this->app->version(), 'Lumen') !== false;
}
}

0 comments on commit c98620e

Please sign in to comment.