You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Request validation with an ::exists() rule passes validation with a value that does not exist in the table.
Let's assume the table users has a foreign_id field it is possible to have the below validation rules and send a request containing '123aabbcc' in the foreign_id value and the validation will pass as long as foreign_table has a row with an id of 123.
class UpdateUserRequest extends FormRequest
{
public function rules(): array
{
return [
'foreign_id' => [
'required',
Rule::exists(ForeignTable::class, 'id'),
],
];
}
}
Steps To Reproduce
create a validaiton rule containging ::exists()
insert just one row in the table that gets checked in the ::exists(), with an id of 1
make a postman request where the ::exists checks for a value of '1aabbcc'.