request = $request; $this->javascript = $javascript; $this->dispatcher = $dispatcher; $this->filter = $filter; } public function compose(View $view) { $this->injectJavaScript($view); $this->addExtra($view); } public function injectJavaScript(View $view) { $scripts = []; $scripts = $this->filter->apply('scripts', $scripts); $view->with([ 'i18n' => $this->javascript->generate(app()->getLocale()), 'scripts' => $scripts, 'inline_js' => option('custom_js'), ]); } public function addExtra(View $view) { $content = []; $this->dispatcher->dispatch(new \App\Events\RenderingFooter($content)); $view->with('extra_foot', $content); } }