vendredi 17 février 2017

laravel pass 2 dimensional array in view

i want to pas an array in the view view

controller code is

$data['medications'] = array('medicine' => 'meds',
                             'dosage' => 'dosage');

return view('medications.index', $data);

i cant retrieve it in view using for each

@foreach($medications as $data)
  //this results in "Trying to get property of non-object"
  //this results in "Illegal string offset 'medicine'"
@endforeach



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire