Answer the question
In order to leave comments, you need to log in
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'hidi. users' doesn't exist?
Everything seems to be OK in the database, the fields are correctly written in the tables too. When I try to register for the lesson https://www.youtube.com/watch?v=prl9r8nBJ5w&t=225s , I get this error. And in the sql query, the spaces before the name of the table and field came from somewhere.
Here is the controller code:
class RegisterController extends Controller
{
public function save(Request $request){
if (Auth::check()){
return redirect(route('Authentication'));
}
$validateFields = $request->validate([
'Name' => 'required|string',
'Surname' => 'string',
'Patronymic' => 'string',
'Login' => 'required|string|unique: users, Login',
'Password' => 'required|confirmed',
]);
$user = User::create($validateFields);
if ($user){
Auth::login($user);
return redirect(route('Account'));
}
return redirect(route('Main'))->withErrors([
'formError' => 'Произошла ошибка при регистрации!',
]);
}
}
Answer the question
In order to leave comments, you need to log in
'Login' => 'required|string|unique: users, Login',
'Login' => 'required|string|unique:users,Login',
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question