I am trying that from controller pass values (from database column), to vue.js component (for select option in v-for), but when I send from controller to blade and get as prop in vue.js and put as data, I get every character in json as one select option.
How I can fix that to work properly and to put json object in v-for select?
RolesController.php
$roles = Roles::all('name');
return view('users.create', ['users' => $users]);
And in the blade I pass value to vue component:
<users-add
roles="{{$roles}}"
></users-add>
My UsersAdd.vue:
<select>
<option v-for="role in roles" :value="role">
{{role}}
</option>
</select>
But I get every character in the list from json in the select, instead to get every role name in every select row. For example I get:
{
"
n
a
m
e
"
:
"
m
o
d
e
r
a
t
o
r
"
Instead
moderator
<body>{{ $roles }}</body>?