Laravel: L'ID étranger n'a pas de valeur par défaut
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
$validator = Validator::make($request->all(), [
'preferred_day' => [
'required',
Rule::in('wednesday','friday'),
],
'preferred_time' => 'required|date_format:h:i:s',
'goals' => 'required|min:10',
]);
if ($validator->fails()) {
return response()->json($validator->errors(), 422);
}
$validated = $validator->validated();
$detail = ClientDetail::create($validated);
return new ClientDetailResource($detail);
}
SAMER SAEID