I am creating an associative array through php after doing a data validation, this code is to make the "fullcalendar" library work. However, at the end of that validation I need to do a second validation to add another index, but for some reason this index is left out. What am I doing wrong ?, I can not find the inconvenience.
My code:
foreach ($this->eventos as $key => $value) {
if($value['allDay']==1){
$evts[]= array('id' => base64_encode(tools::my_encrypt($value['id'])),
'title' => $value['titulo'],
'start' => date('Y-m-d', strtotime($value['inicio_fecha'])),
'end' => date('Y-m-d', strtotime($value['fin_fecha'])),
'allDay' => true,
'color' => self::getColor($value['tipo_evento']),
);
}
if($this->tipo == $value['tipo_usuario']){
array_push($evts, array ('tipo' =>'check-circle-o') );
}
}
I am basing myself on these two examples: link
Upload data with Ajax to fullcalendar
In summary: The code creates the json so that the fullcalendar plugin reads it correctly. When an event in the calendar corresponds to the user who is viewing it, it adds an icon. (Or at least that's the idea.)
The problem: It is adding me as if it were another index of this menera (see the end of the code):
{"id": "WVRoV2EzaEhkVlF6ZVUwOWZIeDhoVWZPaEtzRGUvaz0=", "title": "neftali 2", "start": "2018-11-23", "end": "1969-12-31", "allDay": true, "color": "# ff6258"}, {"type": "check-circle-o"} ,
I need you to believe in this way:
{"id": "WVRoV2EzaEhkVlF6ZVUwOWZIeDhoVWZPaEtzRGUvaz0=", "title": "neftali 2", "start": "2018-11-23", "end": "1969-12-31", "allDay": true, "color": "# ff6258", "type": "check-circle-o" ,
As it should be (separated by "," inside the same key):
I hope you can share a clue with me, I'm really tied up.
Thanks, regards.