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 Illuminate\Support\Facades\Validator;
$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;
}