Render does not return output
RdeWilde opened this issue · comments
Why does the render
-method output a path instead of the view representation? According to the docs, it should return the content for the view:
Base method doc:
Get the view / view contents that represent the component.
How can I render the output for the component from PHP?
I tried this, but as the render returns just a path, I don't get the actual output:
$autocomplete = new FormAutocomplete(
'id',
'label'
);
echo $autocomplete->render();
You can return the path as well, the framework checks if it exists and then resolves it:
https://github.com/laravel/framework/blob/v8.80.0/src/Illuminate/View/Component.php#L78
https://github.com/laravel/framework/blob/v8.80.0/src/Illuminate/View/Compilers/BladeCompiler.php#L300