Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions src/AnnotationsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ class AnnotationsServiceProvider extends ServiceProvider
* @var AnnotationFinder
*/
protected $finder;

/**
* The name of the local environment
*
* @var string
*/
protected $localEnvironmentName = 'local';

/**
* @param \Illuminate\Contracts\Foundation\Application $app
Expand Down Expand Up @@ -122,6 +129,16 @@ public function boot()

$this->loadAnnotatedModels();
}

/**
* Returns the name of the local environment
*
* @return string
*/
protected function getLocalEnvironmentName()
{
return $this->localEnvironmentName;
}

/**
* Register the commands.
Expand Down Expand Up @@ -264,7 +281,7 @@ public function addModelAnnotations(ModelScanner $scanner)
*/
public function loadAnnotatedEvents()
{
if ($this->app->environment('local') && $this->scanWhenLocal) {
if ($this->app->environment($this->getLocalEnvironmentName()) && $this->scanWhenLocal) {
$this->scanEvents();
}

Expand Down Expand Up @@ -316,7 +333,7 @@ protected function loadScannedEvents()
*/
protected function loadAnnotatedRoutes()
{
if ($this->app->environment('local') && $this->scanWhenLocal) {
if ($this->app->environment($this->getLocalEnvironmentName()) && $this->scanWhenLocal) {
$this->scanRoutes();
}

Expand Down Expand Up @@ -370,7 +387,7 @@ protected function loadScannedRoutes()
*/
protected function loadAnnotatedModels()
{
if ($this->app->environment('local') && $this->scanWhenLocal) {
if ($this->app->environment($this->getLocalEnvironmentName()) && $this->scanWhenLocal) {
$this->scanModels();
}

Expand Down