Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AnnotationsServiceProvider.php #108

Open
wants to merge 1 commit into
base: 6.0
Choose a base branch
from
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