Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel Call to a member function validate() on array

//I see your problem It is because you are calling validate on array $data

return $data->validate([
                    'LieferNr' => ['required', 'min:5', 'max:5'],
                    'Produkt' => ['required'],
                    'PH' => ['required', 'numeric', "min:$PHmin", "max:$PHmax"],
                    'Wasser' => "required|numeric|min:$Wassermin|max:$Wassermax",
                    'Dichte' => "required|numeric|min:$Dichtemin|max:$Dichtemax",
                    'Bearbeiter' => ['required'],
                ]);

//Instead, do following

use IlluminateSupportFacadesValidator;
$validator = Validator::make($data, [
                    'LieferNr' => ['required', 'min:5', 'max:5'],
                    'Produkt' => ['required'],
                    'PH' => ['required', 'numeric', "min:$PHmin", "max:$PHmax"],
                    'Wasser' => "required|numeric|min:$Wassermin|max:$Wassermax",
                    'Dichte' => "required|numeric|min:$Dichtemin|max:$Dichtemax",
                    'Bearbeiter' => ['required'],
                ]);

if($validator->fails()){
 return 0;
}
 
PREVIOUS NEXT
Tagged: #laravel #Call #member #function #array
ADD COMMENT
Topic
Name
6+2 =