laravel如何插入多个值

hello everyone i'm beginner in laravel, i want to know how do i inserting a multiple value to a table like, i have an order_detail table on my database and it has order_id, product_id, price and total,

i want to insert a multiple value so i create the form like this which can be added using javascript

<?php for($x = 1;$x <=2; $x++){ ?>

  {{ Form::text('', $x]) }}
  {{ Form::text('pj[$x]order_id') }}
  {{ Form::text('pj[$x]product_id) }}
  {{ Form::text('pj[$x]price) }}
  {{ Form::text('pj[$x]total) }}
  {{ Form::submit('insert!') }}

<?php } ?>

and then i try something like this in my OrderDetailController

$inputs = Input::get('pj');

if(DB::table('order_detail')->insert($inputs)){
  return Redirect::route('admin.order_detail.index')
                  ->with('message','success');
}
return Redirect::back()
         ->with('message','something went wrong')
         ->withInput();

but i only get 1 value from my input which is the last one

ps: this is my first time asking question in this forum, so if you need any information feel free to ask me, and pardon for my bad English, thanks in advance!

thanks!! really thanks for both of you. here, i combine my code with the reference from both of your code

my form

@for($x = 1; $x <=2; $x++)

  {{ Form::text('', $x]) }}
  {{ Form::text('pj['. $x .'][order_id]') }}
  {{ Form::text('pj['. $x .'][product_id]') }}
  {{ Form::text('pj['. $x .'][price]') }}
  {{ Form::text('pj['. $x .'][total]') }}

@endfor

{{ Form::submit('insert!') }}

and here's my function

$pj = Input::get('pj');

foreach($pj as $order) {
  if(DB::table('order_detail')->insert($order)) {}
  else {
    return Redirect::route('admin.order_detail.index')->with('message','failed');
  }
}

return Redirect::route('admin.order_detail.index')->with('message','success');

Can you print your input? I will check it. Or try this code:

$inputs = Input::get('pj');
foreach($inputs as $input){
   if(DB::table('order_detail')->insert($input)){}
   else{
      return Redirect::back()
        ->with('message','something went wrong')
        ->withInput();
      }
}
Redirect::route('admin.order_detail.index')
              ->with('message','success');

At first, you have typo in the code, this:

{{ Form::text('pj[$x]product_id) }}

should be:

{{ Form::text('pj[$x]product_id') }}

This creates text input:

<input name="pj1product_id" type="text">

Input name like this you should parse in PHP, but you can use array of form fields.

Not tested example:

@for($x = 1;$x <=2; $x++)
   {{ Form::text('', $x) }}
   {{ Form::text('pj[][order_id]') }}
   {{ Form::text('pj[][product_id]') }}
   {{ Form::text('pj[][price]') }}
   {{ Form::text('pj[][total]') }}
@endfor
{{ Form::submit('Insert') }}

And PHP:

$pj = Input::get('pj');
foreach($pj as $key=>$order) {
   DB::table('order_detail')->insert($order);
}