S
S
Sergey Nikolaev2015-07-18 14:26:27
Laravel
Sergey Nikolaev, 2015-07-18 14:26:27

How to not allow undeclared fields in laravel validation?

Let's say I check the data:

Validator::make($data, [
    'email' => 'email|required',
    'pass' => 'between:6,30|required',
]);

But if a parameter comes to data, for example login, then it will not be processed in any way, and if $data is injected into the database, then it will bypass the checks and write to the database.
How to make the validator not skip/remove all fields not specified in the validator?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OnYourLips, 2015-07-18
@Devastor

laravel.com/docs/5.1/eloquent#mass-assignment

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question