Ghost Exploiter Team Official
Mass Deface
Directory >>
/
var
/
www
/
html
/
back
/
vendor
/
spatie
/
laravel-data
/
docs
/
validation
/
Mass Deface Auto Detect Domain
/*Ubah Ke document_root untuk mass deface*/
File / Folder
Size
Action
.
-
type
file
dir
+File/Dir
_index.md
0.035KB
edt
ren
auto-rule-inferring.md
2.088KB
edt
ren
introduction.md
9.39KB
edt
ren
manual-rules.md
5.238KB
edt
ren
nesting-data.md
3.078KB
edt
ren
skipping-validation.md
1.509KB
edt
ren
using-validation-attrib
...
6.304KB
edt
ren
working-with-the-valida
...
3.395KB
edt
ren
--- title: Skipping validation weight: 7 --- Sometimes you don't want properties to be automatically validated, for instance when you're manually overwriting the rules method like this: ```php class SongData extends Data { public function __construct( public string $name, ) { } public static function fromRequest(Request $request): static{ return new self("{$request->input('first_name')} {$request->input('last_name')}") } public static function rules(): array { return [ 'first_name' => ['required', 'string'], 'last_name' => ['required', 'string'], ]; } } ``` When a request is being validated, the rules will look like this: ```php [ 'name' => ['required', 'string'], 'first_name' => ['required', 'string'], 'last_name' => ['required', 'string'], ] ``` We know we never want to validate the `name` property since it won't be in the request payload, this can be done as such: ```php class SongData extends Data { public function __construct( #[WithoutValidation] public string $name, ) { } } ``` Now the validation rules will look like this: ```php [ 'first_name' => ['required', 'string'], 'last_name' => ['required', 'string'], ] ``` ## Skipping validation for all properties By using [data factories](/docs/laravel-data/v4/as-a-data-transfer-object/factories) or setting the `validation_strategy` in the `data.php` config you can skip validation for all properties of a data class.