Skip to content

Conversation

@xurshudyan
Copy link
Contributor

Currently, the Pipeline class directly accesses $this->container when running the pipeline within a database transaction:

$this->container->make('db')->transaction(fn () => $pipeline($this->passable));

If the container is not set, this causes a fatal error:

Call to a member function make() on null

This error is unhelpful and makes debugging difficult.

This PR improves the robustness of the Pipeline by replacing the direct container access with the existing getContainer() method, which throws a clear and descriptive RuntimeException if the container is missing:

$this->getContainer()->make('db')->transaction(fn () => $pipeline($this->passable));

This ensures that users get a meaningful error message:

A container instance has not been passed to the Pipeline.

Additionally, a test was added to verify this behavior when transactions are enabled but no container is set.

@taylorotwell taylorotwell merged commit a182063 into laravel:12.x Jul 27, 2025
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants