1
I am trying to register a user in the table and is returning the following error:
SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select count(*) as aggregate from
userswhere
email= ****@gmail.com)
My connection code:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'teste'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', '/tmp/mysql.sock'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
My Controller:
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'user' => 'required|max:100',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6|confirmed',
]);
}
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'user' => $data['user'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
My Model:
protected $fillable = [
'name', 'user', 'email', 'password',
];
Changed settings in file
.env
at the root of your project?– novic
Worse than not, how does this configuration?
– Wagner Viana