.php
<?php
$validator=Validator::make($request->all(), [
'user_id'=>'required|numeric|exists:users,id'
]);
if ($validator->fails()){
return response()->json($validator->messages(), 422);
}
?>
<?php
$validator=Validator::make($request->all(), [
'user_id'=>'required|numeric|exists:users,id'
]);
if ($validator->fails()){
return response()->json($validator->messages(), 422);
}
?>