害害害害害害害害害害

This commit is contained in:
iVampireSP.com 2022-09-13 12:25:17 +08:00
parent 29b8e43a9d
commit 1d44b34b53
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -25,18 +25,16 @@ public function store(Request $request) {
'host_id' => 'nullable|sometimes|exists:hosts,id', 'host_id' => 'nullable|sometimes|exists:hosts,id',
]); ]);
$request = $request->all();
// module_id 和 host_id 必须有个要填写 // module_id 和 host_id 必须有个要填写
if (!$request['module_id'] ?? 0 && !$request['host_id'] ?? 0) { if (!$request->module_id && !$request->host_id) {
return $this->error('module_id 和 host_id 至少要填写一个'); return $this->error('module_id 和 host_id 至少要填写一个');
} }
$workOrder = WorkOrder::create([ $workOrder = WorkOrder::create([
'title' => $request['title'], 'title' => $request->title,
'content' => $request['content'], 'content' => $request->content,
'module_id' => $request['module_id'], 'module_id' => $request->module_id,
'host_id' => $request['host_id'], 'host_id' => $request->host_id,
'status' => 'pending', 'status' => 'pending',
]); ]);