Hopefully someone here can help me with this, I'm kinda stuck here...
I have a form looks like this:
@extends('layouts.properties')
@section('content')
{{ Form::open(['route' => 'properties.store', 'class' => 'uk-form', 'id' => 'properties-form']) }}
@for ($i = 0; $i < Auth::user()->properties_count; $i++)
<fieldset class="uk-margin-large-top property-field-{{ $i + 1 }}">
{{ Form::select('boro[]', ['Pick Borough', 'Manhattan', 'Bronx', 'Brooklyn', 'Queens', 'Staten Island']) }}
{{ Form::text('house_num[]', Input::old('house_num'), ['class' => 'uk-form-width-small', 'placeholder' => 'House Num']) }}
{{ Form::text('street[]', Input::old('street'), ['placeholder' => 'Street']) }}
</fieldset>
@endfor
{{ Form::submit('Save Properties', ['class' => 'uk-button uk-button-primary']) }}
{{ Form::close() }}
@stop
So if the user have 3 properties, he will get 3 fieldsets to fill in his properties. and every type of fieldset goes into an array.
In my controller I have:
$boro = array_filter(Input::get('boro'));
$house_num = array_filter(Input::get('house_num'));
$street = array_filter(Input::get('street'));
I run array_filter just incase the user has 3 properties to fill but he only filled in 2 so this will unset the empty values.
Now I can't figure how to loop thru and insert it to my db..
Idea?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community