I have a POST endpoint on my Laravel 5.7 API and Mariadb 10.3, I used postman to test my route and here is the problem. I want to send an array of the same kind of object, like this :
{
"Shops":[
{
"name": {
"en":"ShopEng",
"es":"ShopESP"
},
"code": "0891"
}
]
}
In my database.I have Shops table and Name field as JSON type.
{"en":"TestEng","es":"TestESP"}
In my Request. I also tried with the simple but not work.
public function rules()
{
return array(
'Shop' => 'required|array',
'Shop.*.name.en' => 'required|unique:shops,name->en',
'Shop.*.name.es' => 'required|unique:shops,name->es',
'code' => 'required|integer'
);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire