I have update the code for get method as follows which working properly in swagger.
Can any one please suggest me the swagger code for post, put, delete with its laravel route, controller code. (As I mention follows for GET)
route/web.php
Route::group(['prefix' => 'api/'], function () {
Route::get('dashboard', 'DashboardController@index');
});
DashboardController.php
* Display a listing of the resource.
*
* @return \Illuminate\Http\JsonResponse
*
* @SWG\Get(
* path="/api/dashboard",
* description="Returns dashboard overview.",
* operationId="api.dashboard.index",
* produces={"application/json"},
* tags={"dashboard"},
* @SWG\Response(
* response=200,
* description="Dashboard overview."
* ),
* @SWG\Response(
* response=401,
* description="Unauthorized action.",
* )
* )
*/
public function index(Request $request)
{
return response()->json([
'result' => [
'statistics' => [
'users' => [
'name' => 'Name',
'email' => 'user@example.com'
]
],
],
'message' => '',
'type' => 'success',
'status' => 0
]);
}
I have found code parameters for post, delete routes at following link
Bellow laravel routes for swagger Post/Put/Delete.
For Post
For Put
For Delete By ID
For Get
For Get By ID