0๐
โ
You can simply use implode()
function to print your array data,
labels : [
{{implode(",", $action_names)}}
]
&
data : [
{{implode(",", $action_count)}}
]
0๐
you canโt to put a php function like this
labels : {{print_r($action_names, true)}}
...
data: {{print_r($action_count,true)}}
try to isolate in a var
labels : { {$action_names} }
...
data: { {$action_count} }
0๐
When you want to use the data in a script or something like that, you have to escape it, basically donโt use {{something}} but use {!!something!!}
0๐
Define new javascript array from existing php array using following syntax:
var labelValues = [<?php echo '"'.implode('","', $php_array).'"' ?>];
Source:stackexchange.com