score:0

Accepted answer

Before line:

foreach ($documents as $document)

you should add:

$arraydoc = array();

and then change line:

$arraydoc= array('name' =>$document->nomdoc,'image'=>$imagedo,'group'=>3);

into:

$arraydoc[] = array('name' =>$document->nomdoc,'image'=>$imagedo,'group'=>3);

Related Query

More Query from same tag