@Sinnbeck sir, when i get $bodydata = $request->getBody()->getContents();
now the body data is :
$bodydata = '[
{
"name":"name 1",
"age":18
},
{
"name":"name 2",
"age":19
},
{
"name":"name 3",
"age":18
}
]';
i decode the body data $result = User::insert(json_decode($bodydata, true));
Slim Application Error
The application could not run because of the following error:
Details
Type: InvalidArgumentException
Code: 0
Message: Invalid HTTP status code.
File: C:\wamp64\www\vendor\slim\psr7\src\Response.php
Line: 191
Trace
#0 C:\wamp64\www\vendor\slim\psr7\src\Response.php(153): Slim\Psr7\Response->filterStatus('HY000')
#1 C:\wamp64\www\vendor\slim\http\src\Response.php(191): Slim\Psr7\Response->withStatus('HY000', '')
#2 C:\wamp64\www\public\api\index.php(46): Slim\Http\Response->withStatus('HY000')
#3 C:\wamp64\www\vendor\slim\slim\Slim\Middleware\ErrorMiddleware.php(127): {closure}(Object(Slim\Http\ServerRequest), Object(Illuminate\Database\QueryException), true, true, true)
#4 C:\wamp64\www\vendor\slim\slim\Slim\Middleware\ErrorMiddleware.php(109): Slim\Middleware\ErrorMiddleware->handleException(Object(Slim\Http\ServerRequest), Object(Illuminate\Database\QueryException))
#5 C:\wamp64\www\vendor\slim\slim\Slim\MiddlewareDispatcher.php(147): Slim\Middleware\ErrorMiddleware->process(Object(Slim\Http\ServerRequest), Object(class@anonymous))
#6 C:\wamp64\www\vendor\slim\slim\Slim\Middleware\ErrorMiddleware.php(107): class@anonymous->handle(Object(Slim\Http\ServerRequest))
#7 C:\wamp64\www\vendor\slim\slim\Slim\MiddlewareDispatcher.php(147): Slim\Middleware\ErrorMiddleware->process(Object(Slim\Http\ServerRequest), Object(class@anonymous))
#8 C:\wamp64\www\vendor\slim\slim\Slim\MiddlewareDispatcher.php(81): class@anonymous->handle(Object(Slim\Http\ServerRequest))
#9 C:\wamp64\www\vendor\slim\slim\Slim\App.php(215): Slim\MiddlewareDispatcher->handle(Object(Slim\Http\ServerRequest))
#10 C:\wamp64\www\vendor\slim\slim\Slim\App.php(199): Slim\App->handle(Object(Slim\Http\ServerRequest))
#11 C:\wamp64\www\public\api\index.php(621): Slim\App->run()
#12 {main}