I have been trying to get this api up and running and keep on experiencing this error when I test in Postman.
1. api.php
Route::group(['middleware' => ['api','cors']], function () {
Route::post('auth/register', 'Auth\RegisterController@create');
});
2. RegisterController
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}}
Postman configuration set to Post, the body is set to raw and JSON(application/json) Below is the postman json code.
{ "name": "Walter White", "email": "[email protected]", "password": "testpassword" }
Below is the error Too few arguments to function App\Http\Controllers\Auth\RegisterController::create(), 0 passed and exactly 1 expected in file C:\xampp\examplestuff