Join the Stack Overflow Community
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

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!

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.