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',
];
このファイルでのみ機能するようにします。どうすれば変更できますか?