prohibited需要验证的字段必须不存在或为空。如果符合以下条件之一,字段将被认为是“空”:值为null。 值为空字符串。 值为空数组或空的可计数对象。 值为上传文件,但文件路径为空。prohibited_if:anotherfield,value,...如果anotherfield 字段等于任何 value,则需要验证的字段必须不存在或为空。如果符合...
当anotherfield 字段等于任何 value 时,在验证时,该字段必须缺失或空。字段为「空」的情况如下:值为null。 值为空字符串。 值为空数组或空的 Countable 对象。 值为路径为空的上传文件。如果需要复杂的条件禁用逻辑,可以使用 Rule::prohibitedIf 方法。此方法接受一个布尔值或闭包。使用闭包时,闭包应该返回 true...
prohibited_if:anotherfield,value,...如果anotherfield 字段等于任何值,则验证中的字段必须为空或不存在。prohibited_unless:anotherfield,value,...验证中的字段必须为空或不存在,除非 anotherfield 字段等于 value。prohibits:anotherfield,...如果验证中的字段存在,则 anotherfield 中不能存在任何字段,...
Bail Exclude Exclude If Exclude Unless Exclude With Exclude Without Filled Missing Missing If Missing Unless Missing With Missing With All Nullable Present Present If Present Unless Present With Present With All Prohibited Prohibited If Prohibited Unless Prohibits Required Required If Required If ...
(File) In In Array Integer IP Address MAC Address JSON Less Than Less Than Or Equal Max MIME Types MIME Type By File Extension Min Multiple Of Not In Not Regex Nullable Numeric Password Present Prohibited Prohibited If Prohibited Unless Prohibits Regular Expression Required Required If Required ...
If Missing Unless Missing With Missing With All Multiple Of Not In Not Regex Nullable Numeric Password Present Prohibited Prohibited If Prohibited Unless Prohibits Regular Expression Required Required If Required Unless Required With Required With All Required Without Required Without All Required Array ...
not_regex:pattern nullable numeric present present_if:anotherfield,value,... present_unless:anotherfield,value present_with:foo,bar,... present_with_all:foo,bar,... prohibited prohibited_if:anotherfield,value,... prohibited_unless:anotherfield,value,... prohibits:anotherfield,... regex:patter...
Sometimes, we wish to check if the value of a given model key has been affected by a change or not. Laravel ships with the "originalIsEquivalent()" method to do exactly that 🚀 <?php $user = User::firstOrFail(); // ['name' => 'old'] $user->name = 'old'; // Keep the ...
Document hashedValue as non-nullable by @JurianArie in #54615 Prohibited If Declined and Prohibited If Accepted validation rules by @osama-98 in #54608 Fix param types for orWhereHasMorph method by @simonellensohn in #54659 Add pascal alias for studly string helper by @da-mask in #...
Both of these methods accept a third parameter. If the third parameter is null then the return of a prohibited access will beApp::abort(403), otherwise the third parameter will be returned. So you can use it like: Ntrust::routeNeedsRole('admin/advanced*','owner', Redirect::to('/home...