Closed antonkomarev closed 9 years ago
You can pretty much check if the app is running on console or not by doing something like
if ($this->app->runningInConsole()) {
// stuff that should run only on console here
}
If you want an example.
Thanks for the publishing solution. I mean that maybe it would be good to have this recommendation in official documentation? Because most of the packages don't have it. It could be helpful to make custom packages better.
Hello, guys!
Because that all code inside ServiceProviders boot() methods is calling all the time in all requests, it even trying to publish migrations, configs and in some of packages it doing some kind of preparations of files before publishing or doing other stuff which isn't needed for production usage and should be used only in console. Am I missed something?
If it's true, what do you think about optimization of this behaviour by adding a helper methods to separate blocks on code for only console usage in boot method or at least write about it in documentation. Because I haven't seen any kind of checks for such thing in any of packages I've used recently.