Skip to content

Commit ecfddaf

Browse files
KennedyTedescotaylorotwell
authored andcommitted
[5.4] Brings back to app() the ability to make instances passing parameters (#18320)
Following: #18271
1 parent 4df49b4 commit ecfddaf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Illuminate/Foundation/helpers.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,18 @@ function action($name, $parameters = [], $absolute = true)
9494
* Get the available container instance.
9595
*
9696
* @param string $abstract
97+
* @param array $parameters
9798
* @return mixed|\Illuminate\Foundation\Application
9899
*/
99-
function app($abstract = null)
100+
function app($abstract = null, array $parameters = [])
100101
{
101102
if (is_null($abstract)) {
102103
return Container::getInstance();
103104
}
104105

105-
return Container::getInstance()->make($abstract);
106+
return empty($parameters)
107+
? Container::getInstance()->make($abstract)
108+
: Container::getInstance()->makeWith($abstract, $parameters);
106109
}
107110
}
108111

0 commit comments

Comments
 (0)