vendredi 13 juillet 2018

How to save array request in database

my table

$table->increments('id');
$table->string('productname');
$table->string('qty');
$table->string('price');
$table->string('priceinword');
$table->timestamps();

form is coming to controller like this

  array:5 [▼
  "_token" => "za1Pzkwihk7trQcf2xWIxVjIzPBycl5Ix8dYYTjD"
  "productname" => array:2 [▼
    0 => "product 1"
    1 => "product 2"
  ]
  "qty" => array:2 [▼
    0 => "1"
    1 => "1"
  ]
  "price" => array:2 [▼
    0 => "123"
    1 => "321"
  ]
  "priceinword" => array:2 [▼
    0 => "one two three"
    1 => "three two one"
  ]
]

how to save data to products table in array how to solve this query



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire