0👍
✅
You can drop the $key
and give a more meaningful name to $val
. Just access it directly, like this:
foreach ($request->get('hives') as $hive) {
$new_hive = new Hive;
$new_hive->quantity = $hive->quantity;
$new_hive->action = $hive->action;
}
Form Request validation is well covered in the documentation: https://laravel.com/docs/5.1/validation#form-request-validation
Source:stackexchange.com