Skip to content
Advertisement

Base table or view not found in laravel 6 when using validator

I belong to the reader gang and this happens to be my first question on SO. Pls, pardon me for mistake

I was trying to validate request in register function. Here is the code.

JavaScript

This is sendResponse method

JavaScript

This is sendError method

JavaScript

Response I am getting

JavaScript

Note: I have also tried to use public $table='users' to no avail.

I hope someone will come to rescue.

Also if i remove

JavaScript

it works good but not validation message is being returned

Advertisement

Answer

Tables are plural in Laravel by design. The unique rule is not based on a model, but the parameter you pass to it is the table name. So that parameter should be plural and therefor the validation should look like this.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement