1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; class SwaggerController extends Controller { /** * @SWG\Get( * path="/api/testing/{mytest}", * summary="Get Testing", * operationId="testing", * @SWG\Response(response=200, description="successful operation"), * @SWG\Response(response=406, description="not acceptable"), * @SWG\Response(response=500, description="internal server error"), * @SWG\Parameter( * name="mytest", * in="path", * required=true, * description="testing data", * type="string" * ), * ) * */ public function index(Request $request){ echo $request->mytest; } /** * @SWG\Post( * path="/api/testpost", * summary="Post Testing", * operationId="posttesting", * @SWG\Response(response=200, description="successful operation"), * @SWG\Response(response=406, description="not acceptable"), * @SWG\Response(response=500, description="internal server error"), * @SWG\Parameter( * name="name", * in="body", * description="testing data", * required=true, * type="string", * @SWG\Schema(@SWG\Property(property="name", type="string", example="abc")), * ), * ) * */ public function postindex(Request $request){ echo $request->name; } /** * @SWG\Post( * path="/api/upload", * summary="Post upload", * operationId="upload file", * @SWG\Response(response=200, description="successful operation"), * @SWG\Response(response=406, description="not acceptable"), * @SWG\Response(response=500, description="internal server error"), * @SWG\Parameter( * name="file_data", * in="formData", * description="testing file", * required=true, * type="file" * ), * ) * */ public function upload(Request $request){ $file = $request->file('file_data'); echo $file->getClientOriginalName(); } } |
Leave a reply