Snippets

Here's some of my tips, tweaks and tuts, ranging from PHP, Linux, MySQL and more!

Snippets / Laravel

Passing strings to Laravel Blade components

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" />

2 years ago / Read More