0

Hi I need help for my project, I tried to make component panel named "x-panel-sum" and I pass a collection array into element "x-panel-sum". But when i call it from my main blade "index.blade" it turns to be weird such as i lose double quote symbol inside my collection

example:

  • normally if i put collection directly in my index.blade
{{ $buildings }}

and it show to be like this:

[{"id":1,"name":"Kantor Pusat"}]

  • But when i try to call x-component
<x-panel-sum building="{{ $buildings }}"></x-panel-sum>

and the result to be like this:

[{&quot;id&quot;:1,&quot;name&quot;:&quot;Kantor Pusat}]

the double quote becomes "&quot", How do i fix this?

1 Answers1

2

You can pass a collection to your component like

<x-panel-sum :building="$buildings"></x-panel-sum>

note the colon before the attribute. This indicates that the parameter is a php variable.

Snapey
  • 3,604
  • 1
  • 21
  • 19