B
B
BonBon Slick2017-04-28 20:46:34
PostgreSQL
BonBon Slick, 2017-04-28 20:46:34

Undefined column: 7 ERROR: column "email" does not exist - Laravel 5.4 validation "unique" with PostgreSQL?

Validation field:

'email' => 'required|filled|string|email|max:125|unique:pgsql.public.users, email',

Class:
class User extends Authenticatable
{
    use Notifiable, SoftDeletes;

    protected $table = "pqsql.public.users";

Mistake:
QueryException in Connection.php line 647:
SQLSTATE[42703]: Undefined column: 7 ERROR: column " email" does not exist
LINE 1: ...count(*) as aggregate from "public"."users" where " email" =...
^
HINT: Perhaps you meant to reference the column "users.email". (SQL: select count(*) as aggregate from "public"."users" where " email" = [email protected])

If you do validation only on the users table, everything works, as soon as I put it on the field, it gives this error.
Why does he not see the field, but sees the table?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
D3lphi, 2017-04-28
@BonBonSlick

Remove the space between the table name and the field.
"email"
/\ This one.

'email' => 'required|filled|string|email|max:125|unique:pgsql.public.users,email',

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question