I am creating signup api 1st is GET call and 2nd is POST call. When I make GET[POSTMAN] call i get proper response from the controller but when I make POST it returns 404.
#web.php
// sign up api
Route::get('signup','Api\RegistrationController@createUser');Route::post('/signup','Api\RegistrationController@storeUser');
RegistrationController.php
public function createUser(){
return "Get : Sign up";
}
public function storeUser() {
// validate the form
$this->validate(request(),[
'firstname' => 'required',
'lastname' => 'required',
'email' => 'required',
'password' => 'required'
]);
// create and save the user
$user = Register::create(request(['firstname', 'lastename',
'email', 'password']));
return "Registration complete";
}
I am using laravel 5.4.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2McgqkR
via IFTTT
Aucun commentaire:
Enregistrer un commentaire