In the Laravel 5.4 Upgrade Guide it states:
The container's make method no longer accepts a second array of parameters. This feature typically indicates a code smell. Typically, you can always construct the object in another way that is more intuitive. Does anybody know what the "more intuitive" way is?
For example, I have code that needs to instantiate an object that may depend on other classes but also on some data such as an Eloquent object so I just do something like:
$transformer = App::make('PostTransformer::class', [$post]);
If I can no longer pass the second array of parameters, what should I do? Is the best solution to just add a setPost() method to set the post after instantiating the object?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community