如何通过链接传递id,因为id链接是唯一的。
This code update socials and send data by array, how to send id to link every every-time
$ids = $request->get('id');
$link = $request->get('link');
$icon = $request->get('icon');
$status = $request->get('status');
//////////////////////////
$validator = Validator::make([
'link' => $link,
'icon' => $icon,
], [
'link.*' => 'required|unique:socials,link,' . $ids,
'icon.*' => 'required',
]);
//////////////////////////
if ($validator->fails())
{
$request->session()->flash('danger', $validator->messages());
return redirect(route('socials.view'))->withInput();
}
else
{
foreach ($ids as $id)
{
$social = new Social();
$info = $social->getSocial($id);
if($info)
{
$social->updateSocial($info,$link[$id],$icon[$id],$status[$id]);
}
}
$request->session()->flash('success', parent::UPDATE_SUCCESS_MESSAGE);
return redirect(route('socials.view'));
}
此代码更新社交和按数组发送数据,如何每次都发送id链接。
执行此代码时,结果(Array to string conversion)