dimanche 18 août 2019

How to write validation rule for JSON laravel?

There is JSON object that I want to validate:

[{
  "id": 1,
  "settings": {
    "GRSYSEM": 1
  }
},
{
  "id": 2,
  "settings": {
    "GRSYSEM": 1
  }
},
{
  "id": 3,
  "settings": {
    "GRSYSEM": 1
  }
}
]

How to write validation rule in Laravel?

I tried this rule:

$validator = Validator::make($request->all(), [
    'id' => 'required|array',
    'id.*' => 'required',
    'settings.*.GRSYSEM' => 'required'
]);



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2P0TLyM
via IFTTT

Aucun commentaire:

Enregistrer un commentaire