I have cv table , user table and share table. Structure of share table shareto_id,cv_id,user_id
There can be any number of shareto_id and cv_id. Suppose i want to save (1) shareto_id and (2)cv_id. But it only saves one data in database. these are the code i have already tried.
$cv_id = explode(",",$cvids);
$shareto_id = explode(",",$sharetoids);
$cvlength = count($cv_id);
$sharetolength = count($shareto_id);
for($i=0; $i<$cvlength; $i++)
{
for($j=0; $j<$sharetolength; $j++)
{
$data['cv_id'] = $cv_id[$i];
$data['user_id'] = $request->user_id;
$data['shareto_id']= $shareto_id[$j];
}
}
Share::create($data);