DictItem::query() ->where('dict_type_id', DictType::query()->where('code', 'demand_type')->value('id')) ->where('value', $v)->value('id'); $status = fn (string $v) => DictItem::query() ->where('dict_type_id', DictType::query()->where('code', 'demand_status')->value('id')) ->where('value', $v)->value('id'); $zhang = Teacher::query()->where('name', '张某某')->first(); $wang = Teacher::query()->where('name', '王某某')->first(); if ($zhang) { Demand::query()->updateOrCreate( ['title' => '寻求材料计算联合课题合作方', 'teacher_id' => $zhang->id], [ 'type_dict_item_id' => $type('tech'), 'status_dict_item_id' => $status('active'), 'content' => '老师希望优先对接材料计算方向联合课题,需匹配企业合作案例。', 'contact_name' => $zhang->name, 'company' => '材料探索科技', 'submitted_at' => '2026-05-08', ] ); } if ($wang) { Demand::query()->updateOrCreate( ['title' => '希望对接中试验证场地资源', 'teacher_id' => $wang->id], [ 'type_dict_item_id' => $type('venue'), 'status_dict_item_id' => $status('done'), 'content' => '希望对接中试验证场地资源,了解预约流程与容量。', 'contact_name' => $wang->name, 'company' => '中试验证平台', 'submitted_at' => '2026-04-22', ] ); } } }