We think you might be interested in this job:

Lead Full-Stack Developer

SPARK Business Works

When running your application under Laravel Octane, one major thing changes; your application is booted only once when the Octane workers start, and that same instance will be used for all requests.

At this point all the register and boot methods of non-deferred service providers has been called, which means all your application services are now bound to the container.

The reason for passing the request to the original application instance is that we want any services that hold reference to the original app instance to still be able to access the request. Even tho passing references to the application instance is highly discouraged by Octane, we still pass the request to handle cases where this happens until all applications and packages can adapt their code. Now that we understand how Octane boots our application and uses it to handle several incoming requests, I want to highlight a few gotchas for application developers and package maintainers: If a service needs to interact with the application instance and you pass it in the constructor, make sure you use the application instance passed to the callback not the one passed to the service provider: The reason is that $this->app holds a reference to the original instance of the application since it was the one used to register the providers on booting.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Community Partners