I've been looking into Laravel Telescope and it mentioned the ability of being able to run only in one's local environment as opposed to production by including the following code snippet in AppServiceProvider
.
public function register()
{
if ($this->app->isLocal()) {
$this->app->register(TelescopeServiceProvider::class);
}
}
This works fine but I am trying to figure out what exactly the isLocal()
method does. So far, I have not been able to find much information.
Thanks,
In your .env
file you would have a APP_ENV
set to local
on your development environment and it will be different on other servers. So isLocal
just checks if that is set to local or not.
Here is the answer from the repository.
To check for a different env other than local or production use this helper function:
config('app.env') // get the env
for production there is a isProduction()
helper function on the app instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With