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
Post a Comment