@wardkennes it is working in postman but not in swagger
/**
* Create category
* @OA\post (
* path="/api/category/store",
* tags={"career category"},
* security={{"apiAuth":{}}},
* @OA\RequestBody(
* @OA\MediaType(
* mediaType="multipart/form-data",
* @OA\Schema(
* @OA\Property(property="name",type="text"),
* @OA\Property(property="description",type="text")
* ),
*
* )
* ),
* @OA\Response(
* response=200,
* description="success",
* ),
* @OA\Response(
* response=400,
* description="invalid",
* @OA\JsonContent(
* @OA\Property(property="msg", type="string", example="fail"),
* )
* )
* )
*/
public function store(Request $request)
{
try {
$validator = Validator::make($request->all(), [
'name' => 'required',
'description' => 'required',
]);
if ($validator->fails()) {
return response()->json($validator->errors(), 400);
}
$data = new Career_category;
$data->name = $request->name;
$data->description = $request->description;
$data->save();
return $this->returnJson($data, 'category successfully stored!', 200, ['total' => $data->count()]);
} catch (Exception $e) {
return $this->returnJson(false, $e->getMessage(), $e->getCode());
}
}