class CategoryController extends Controller
...
public function store(CategoryRequest $request)
{
...
}
}
class CategoryRequest extends Request
{
...
}
我无法通过this->json()->all();
从请求中获取json数据
...
use Illuminate\Foundation\Http\FormRequest;
...
class Request extends FormRequest
{
public function validationData()
{
$this->isJson(); // return true
$this->getContent(); // has data
$this->json()->all(); // empty data
$this->json; // empty data
...
}
}
我使用Talend API
测试api
Content-Type: application/json
{
name: 'this is name'
}
Talend API
:https://i.stack.imgur.com/a6ep0.png this->json()->all();
是如何工作的?