在 Laravel 中存储多个数据
Storing Multiple Data in Laravel
我正在想办法让用户可以在前端添加类型(医疗),但验证者必须批准该记录?我似乎无法为此找到最佳解决方案,有人对如何使这项工作有任何建议吗?它存储在医疗 table 中,但不存储在 Verifier table.
中
简而言之,我正在使用 medicalRecord 控制器来存储医疗和验证程序详细信息。
'document_id' = medical_id;
'submitted_by' = 谁创造了记录
public function store Request $request, $id)
{
if (auth_user_cannot(Capability::CREATE_DRIVER_MEDICAL_RECORD)) {
return redirect($group['name'] . "/" . $group['userId']);
}
$all = $request->all();
if ($request->hasFile('myfile')) {
$result = upload($request->file('myfile'), 'nonzip', 'Medical');
$all['upload'] = $result['upload'];
$all['uploadId'] = $result['uploadId'];
}
// u'll need to save the medical to the user first, then save the verifier to the medical.
$driverMedical = DriverMedicalRecord::create($all);
// Then for the relation;
$medical = $driverMedical->find($id);
$verificationData = DocumentVerification::create( [
'document_id' => $medical,
'submitted_by'=> Auth::id(),
]) ;
$request->user()->posts()->save($post);
$driverMedical->verifier()->save($verificationData);
在同一个 table 中设置一个标志,并在验证后更改其值。
例如:is_verfied
未获批准时应为 0 获批后将其更改为 1(这是我从您的问题中了解到的)
我正在想办法让用户可以在前端添加类型(医疗),但验证者必须批准该记录?我似乎无法为此找到最佳解决方案,有人对如何使这项工作有任何建议吗?它存储在医疗 table 中,但不存储在 Verifier table.
中
简而言之,我正在使用 medicalRecord 控制器来存储医疗和验证程序详细信息。
'document_id' = medical_id;
'submitted_by' = 谁创造了记录
public function store Request $request, $id)
{
if (auth_user_cannot(Capability::CREATE_DRIVER_MEDICAL_RECORD)) {
return redirect($group['name'] . "/" . $group['userId']);
}
$all = $request->all();
if ($request->hasFile('myfile')) {
$result = upload($request->file('myfile'), 'nonzip', 'Medical');
$all['upload'] = $result['upload'];
$all['uploadId'] = $result['uploadId'];
}
// u'll need to save the medical to the user first, then save the verifier to the medical.
$driverMedical = DriverMedicalRecord::create($all);
// Then for the relation;
$medical = $driverMedical->find($id);
$verificationData = DocumentVerification::create( [
'document_id' => $medical,
'submitted_by'=> Auth::id(),
]) ;
$request->user()->posts()->save($post);
$driverMedical->verifier()->save($verificationData);
在同一个 table 中设置一个标志,并在验证后更改其值。
例如:is_verfied
未获批准时应为 0 获批后将其更改为 1(这是我从您的问题中了解到的)