Code:
public function specificationsave(Request $request) {
if (!empty($request->product_id)) {
if (empty($request->specificationkeys) && empty($request->specificationvalues)) {
return response()->json(["message" => 'Empty form submitted'], 202);
} else {
// something code
}
} else {
return response()->json(["message" => 'something went wrong with product'], 403);
}
}
Form code:
<input type="text" name="specificationkeys[]"/>
<input type="text" name="specificationvalues[]"/>
Problem:
When I am putting empty condition on my specificationkeys array it is not working, because my key has a empty array so I can i check that the key has array or not or as I want empty check without validator because fields are not mandatory.
dd($request->specificationkeys)anddd($request->specificationvalues)