Answer the question
In order to leave comments, you need to log in
Inserting data into a database?
Good afternoon! Please advise how to implement the following. There are 2 data arrays, they come from the form, it looks like this.
[ "name" => "csadcasdc"
"bust" => "90"
"waist" => "90"
"hips" => "90"
"dress" => "22"
"shoe" => "22"
"hair" => "Красный"
"eye" => "Зеленый"
"stature" => "180"
"gallery" => array:4
0 => "84"
1 => "85"
2 => "86"
3 => "87"
]
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
foreach( $request['gallery'] as $gallery ):
$modelGallery['gallery'] = $gallery;
$modelGallery->save();
endforeach;
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//About model
$model->name = $request['name'];
$model->about = $request['body'];
// Body paramethre's
$model->bust = $request['bust'];
$model->waist = $request['waist'];//...
$model->save();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question