How to deserializae POST data in Laravel and validate? -


i have incoming $_post data as:

array("data" => "{"id" : 2, "name" : "ok", "orders": {"f" : "ok"}}") 

so, need deserialize $_post["data"], , validate fields inside $_post["data"] using standard validation in laravel this:

$validator = validator::make($request->all(), [     "data.id" => "required|integer" ]); 

how to that?

after json_decode got array:

array:13 [▼   "id" => 17   "unique_code" => null   "name" => "Михаил"   "secondname" => "Попов"   "lastname" => "Яковлевич"   "datebirth" => "12/10/1992 00:00:00"   "taxcode" => "5656"   "gender" => "1"   "created_at" => null   "file" => ""   "orders" => {#324 ▶}   "http_code" => null   "status" => null ] 

further can not access "orders.kind_work" => "required|string"


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -