I am posting an array of form data using VueJs, this is what it looks like:
hives: [{
hive_type_id: '',
quantity: '',
yard_id: this.yardId,
action: 'added',
added_from: '',
converted_to: '',
notes: '',
logged_at: moment().format('DD-MM-YYYY'),
}]
1) How do I access this in my controller to store to the DB? I have tried, using a foreach:
foreach($request->get('hives') as $key => $val) { ... }
And then accessing each individual hive data: e.g.
$request->action[$key]
$request->added_from[$key]
But am having no luck storing to the DB.
2) How would I validate this array using a Form Request?
Thanks for you help!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire