Assuming we have a `User` model with the default rut columns and the trait included:
User::factory()->create(['rut' => '11.111.111-1']);
$data = ['rut' => '11.111.111-1'];
$rules = ['rut' => ['required', 'rut_unique:users,rut_num'];
validator($data, $rules)->validate(); // ValidationException should be thrown.
PHP & Platform
8.3
Database
MySQL 8
Laravel version
11.x
Have you done this?
Expectation
Assuming we have a
User
model with the default rut columns and the trait included:Description
I've narrowed the problem to the
Laragear\Rut\ValidatesRut::query
protected method, where the following query is made:For the above example, the generated SQL query will be
Which will always return 0 (false) since
UPPER("rut_vd")
is not checking the column but a string literal"RUT_VD"
.The easy fix is to change this line to
or
Reproduction
Stack trace & logs
No response