dimanche 23 juillet 2017

Laravel Unable to make a POST request to API

I am trying to make a post request to SignUp API in laravel.

    {
        "message": "SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) 
        (SQL: insert into `users` (`email`, `password`, `firstName`, `lastName`, `role_id`, `title`, `gender`, `dob`, `nativeLanguage`, `city`, `country`, `updated_at`, `created_at`) values (test@test.com, $2y$10$QEgk7dZig8aJfWJu8cvDIuOOEhA.QE6FT/XbZG3avCpYkGfTegBXy, Raj, Parekh, 1, Mr., M, 1992-10-10, English, Jersey City, USA, 2017-07-23 23:32:17, 2017-07-23 23:32:17))",
        "code": 1045,
        "status_code": 500
    }

When I do php artisan migrate, all the tables are been built into my database. But when I make a POST request then I am getting this error.

Here is my .env file config:

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=root
DB_PASSWORD=

I have also changed the database.php file

'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
        ],

There is no problem with database credentials. I am able to login with the specified credentials.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire