Laravel saving dynamic input data array in to database
<p>I'm trying to save a dynamic form in laravel. unable to save data array in to data base. following is the form. 
<a href="https://i.stack.imgur.com/H4tiA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H4tiA.jpg" alt="enter image description here"></a></p>

<p><strong>normal form fields in short</strong></p>

<pre><code>{!! Form::select('customer_id', ['' =&gt; 'Select a customer'] + $customer_list ,null , array('class' =&gt; 'form-control', 'id' =&gt; 'customer')) !!}
{!! Form::text('mileage_in', null, ['class' =&gt; 'form-control', 'placeholder' =&gt; 'Mileage In']) !!}
.
.
.etc...
</code></pre>

<p><strong>Dynamic form fields</strong></p>

<pre><code>{!! Form::select('item_id[][item_id]', $items, null, array('class' =&gt; 'form-control')) !!}
{!! Form::text('item_description[][item_description]', null, ['class' =&gt; 'form-control', 'placeholder' =&gt; 'Not Required | Optional']) !!}
{!! Form::text('units[][units]', null, ['class' =&gt; 'form-control', 'placeholder' =&gt; 'Add Units']) !!}
{!! Form::text('rate[][rate]', null, ['class' =&gt; 'form-control', 'placeholder' =&gt; 'Add Rate']) !!}
{!! Form::text('amount[][amount]', null, ['class' =&gt; 'form-control', 'placeholder' =&gt; 'Add Hrs and Rate', 'id' =&gt; 'amount']) !!}
</code></pre>

<p>all those fields are in same form.
I'm saving these data into three different tables. </p>

<p>following are the models i created.<br>
<strong>Estimate model for estimates table</strong></p>

<pre><code>class Estimate extends Model
{
    protected $fillable = [
        'customer_id',
        'vehicle_id',
        'mileage_in',
        'net_amount',
        'parent_estimate_id',
        'department',
        'created_by'
    ];
    public function customer(){
        return $this-&gt;belongsTo('App\Customer');
    }
    public function vehicle(){
        return $this-&gt;belongsTo('App\Vehicle');
    }
    public function estimate_details(){
        return $this-&gt;hasMany('App\EstimateDetail');
    }
}
</code></pre>

<p><strong>EstimateDetail model for estimate_details table</strong></p>

<pre><code>class EstimateDetail extends Model
{
    protected $fillable = [
        'estimate_id',
        'item_id',
        'item_description',
        'units',
        'rate',
        'labor_amount_final',
        'initial_amount',
        'task_status'
    ];
    public function item()
    {
        return $this-&gt;hasMany('App\Item');
    }
    public function estimate()
    {
        return $this-&gt;belongsTo('App\Estimate');
    }
}
</code></pre>

<p><strong>Item model for items table</strong></p>

<pre><code>class Item extends Model
{
    protected $fillable = [
        'name',
        'type',
        'location',
        'quantity',
        'sale_price',
        'unit_of_sale',
        'pre_order_level',
        'created_by',
        'category_id',
        'service_only_cost',
        'updated_at'
    ];
    public function estimate_details()
    {
        return $this-&gt;hasMany('App\EstimateDetail');
    }
}
</code></pre>

<p>Following code is the <strong>EstimatesController</strong></p>

<pre><code>class EstimatesController extends Controller
{
public function store(EstimateRequest $request)
    {
        $user_id = '1';

        $input = $request-&gt;all();

        $vehicle = new Vehicle();
        $vehicle-&gt;customer_id = $input['customer_id'];
        $vehicle-&gt;reg_no = $input['reg_no'];
        $vehicle-&gt;make = $input['make'];
        $vehicle-&gt;model = $input['model'];
        $vehicle-&gt;created_by = $user_id;

        $estimate = new Estimate();
        $estimate-&gt;customer_id = $input['customer_id'];
        $estimate-&gt;vehicle_id = $input['vehicle_id'];
        $estimate-&gt;mileage_in = $input['mileage_in'];
        $estimate-&gt;department = $input['department'];
        $estimate-&gt;created_by = $user_id;

        $estimate_detail = new EstimateDetail();
        $estimate_detail-&gt;item_id = $input['item_id'];
        $estimate_detail-&gt;item_description = $input['item_description'];
        $estimate_detail-&gt;units = $input['units'];
        $estimate_detail-&gt;rate = $input['rate'];
        $estimate_detail-&gt;initial_amount = $input['amount'];

        $vehicle-&gt;save($request-&gt;all());
        $vehicle-&gt;estimate()-&gt;save($estimate);
        $estimate-&gt;estimate_details()-&gt;save($estimate_detail);
      }
        return redirect('/estimates');
  }
</code></pre>

<p>I can successfully save vehicle and estimate data on tables vehicles and estimates. but i'm unable to save estimate details arrays on estimate_details table. tried many different ways but failed at last. </p>