我正在使用位于 App\Http\Requests 文件夹中的 Post***Request.php。我有一个表格,只有当我的用户输入他的国家巴基斯坦时,我才想要城市字段。否则,这些字段可以为空。
$city1Rule = 'required_without_all:city1,city2,city3|different:city2|different:city3|in:'.implode (",", $cities);
$city2Rule = 'required_without_all:city1,city2,city3|different:city1|different:city3|in:'.implode (",", $cities);
$city3Rule = 'required_without_all:city1,city2,city3|different:city2|different:city1|in:'.implode (",", $cities);
return [
'country' =>
'city1' => $city1Rule,
'city2' => $city2Rule,
'city3' => $city3Rule,
'other_rules' => 'other_rules',
];
我只想在这个文件中进行这项工作。我该如何修改它?