I'm trying to do a foreach()
inside of one of my controller and I'm running into the error of Invalid argument supplied for foreach()
this is my code
$subAdmins = $request->input('subAdmin');
// Adding subAdmin
foreach($subAdmins as $subAdmin){
$linksubAdmin = new LayMinisterEvents;
$linksubAdmin->user_id = $subAdmin;
$linksubAdmin->event_id = $recordEvent->id;
$linksubAdmin->save();
}
This is the data that is getting sent over 'subAdmins' => '5,6'
at HandleExceptions->handleError(2, 'Invalid argument supplied for
foreach()', '/home/vagrant/www/project-
api/app/Http/Controllers/EventsController.php', 47, array('request' =>
object(Request), 'response' => object(Response), 'authUser' => 1,
'recordEvent' => object(Events), 'linkadminLeader' =>
object(AdminEvent), 'subAdmins' => '5,6'))
in EventsController.php (line 47)
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire