I am passing an ajax
call to delete some user data, and this data is passed in an hidden input, I want to convert it to a PHP Array to be able to do a foreach
loop around it. How can I achieve that?
The values it output in Javascript
,
""49,51,53,54""
The PHP
code,
public function usersDelete(){
$data = Input::all();
$checkedUsers = Input::get('checkedUsers'); // data is an array
foreach ($checkedUsers as $checkedUser) {
User::where('id', '=', $checkedUser)->first()->delete();
}
}
the problem is that it loops only one the first array value in the set of arrays.