Including default header in custom header
Add to Existing Header on a view page
I need to load an external javascript file on a given page. Examples I found suggested using a ->getHeader() with a custom view to do this. But using the custom view gets rid of the default header. I just need to add to it so it loads the script with a script tag.
Is there a way in the custom view to append the default view after it?
I tried the following but it looks like the default ->getHeader() just returns a null value:
public function getHeader(): ?\Illuminate\Contracts\View\View
{
$header = parent::getHeader();
return view('components.custom-header', ['header' => $header]);
}
0 Replies