/**
* Store a newly created resource in storage.
*
* @param IlluminateHttpRequest $request
* @return IlluminateHttpResponse
*/
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);
}