Render a component outside of a Blade template

Is it possible to render a Sage component outside of a blade template? I know I can render a view with \Roots\view('partials.example-view')->render(); but when I try the same with the component, it seems the controller class is never initialized, so now data gets passed to the component. Is there an existing way to do this?

If not, I’m thinking I’ll create a method in my controller to return an array of all the variables to pass to the view like this \Roots\view('components.example-component, $component->outsideData())->render();

1 Like

This topic was automatically closed after 42 days. New replies are no longer allowed.