You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It doesn't work because the global function app() doesn't exist, put this somewhere before the Blade class is instantiated to make it work.
useIlluminate\Container\Container;
$container = newContainer();
Container::setInstance($container);
$container = Container::getInstance();
if (! function_exists('app')) {
/** * Get the available container instance. * * @param string $make * @param array $parameters * @return mixed|\Illuminate\Foundation\Application */functionapp($make = null, $parameters = [])
{
if (is_null($make)) {
returnContainer::getInstance();
}
returnContainer::getInstance()->make($make, $parameters);
}
}
Now injecting into the views works (it's basically instantiating a class of your choice using the Container) and you can also use this DI container for your app.
The text was updated successfully, but these errors were encountered:
It doesn't work because the global function app() doesn't exist, put this somewhere before the Blade class is instantiated to make it work.
Now injecting into the views works (it's basically instantiating a class of your choice using the Container) and you can also use this DI container for your app.
The text was updated successfully, but these errors were encountered: