Just wanted to document here incase anyone else got stuck like me for the last couple of days.
I was getting this error ‘A facade root has not been set’ when trying to use laravel components in a custom theme (not sage based).
I am new when it comese to laravel so reading the laravel docs to understand the request life cycle helped.
In the function.php file I included this code
function laraval_boot(){
if (! function_exists('\Roots\bootloader')) {
wp_die(
__('You need to install Acorn to use this theme.', 'sage'),
'',
[
'link_url' => 'https://roots.io/acorn/docs/installation/',
'link_text' => __('Acorn Docs: Installation', 'sage'),
]
);
}
\Roots\bootloader()->boot();
}
and of course call our add_action
add_action(‘init’, ‘laraval_boot’);
This did the trick for me. Hopefully this can help someone else out if they get stuck.