jeudi 2 mai 2019

Which data do I send wrong?

My incoming JSON object:

{
"date": "2018-10-10", 
"fiche": 1, 
"fiche_type": 2, 
"description": "test", 
"project_code": "444", 
"invoces": 
[{"id": 1, "description": "Ol", "amount": 300, "type": "debit"}, {"id": 2, "type" :"credit", "description": "Ol2", "amount": 200}]}

Validation rules are:

 public function rules()
    {

        return [
            'date' => 'required|date_format:Y-m-d',
            'fiche' => 'required|integer',
            'fiche_type' => 'required|integer',
            'description' => 'string',
            'project_code' => 'string',
            'invoices' => 'required|array',
            'invoices.id' => 'required|integer',
            'invoices.description' => 'string',
            'invoices.amount' => 'required|numeric',
            'invoices.type' => 'required|string',
        ];
    }

I always get a common error as: Wrong data validation



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire