Passing strings to Laravel Blade components

Published: 2 years ago

Difficulty: Easy

Being fairly new to Laravel I have enjoyed recently playing with the framework. I like using the components for form creation in blade templates. I had difficulty passing simple strings to components, passing variables worked but not strings.

What you have to do is within the attribute your passing also wrap your string inside single quoted strings see both id and label parameter

<x-form.select :id="'category_id'" :label="'Category'" :result="$result" :source="$categories" />

comments powered by Disqus
:?>