I am new to laravel, the problem I have encountered is post request is not working with the postman. I have spent the whole day on this error but nothing worked. Maybe I am making a mistake somewhere. Your help will be appreciated.
I also have tried it by disabling the following code in Kernel.php
// \App\Http\Middleware\VerifyCsrfToken::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
api.php
Route::post('country', 'Country\CountryController@countrySave');
Controller.php
public function countrySave(Request $request){
$country = CountryModel::create($request->all());
return response()->json($country, 200);
}
web.php
Route::get('/', function () {
return view('welcome');
});
Following is the error
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: The POST method is not supported for this route. Supported methods: GET, HEAD. in file C:\xampp\htdocs\laravel_tutorial\blog\vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php on line 256