laravel openapi documentation

Solutions on MaxInterview for laravel openapi documentation by the best coders in the world

showing results for - "laravel openapi documentation"
Angela
20 Apr 2019
1class ProjectsApiController extends Controller
2{
3    /**
4     * @OA\Get(
5     *      path="/projects",
6     *      operationId="getProjectsList",
7     *      tags={"Projects"},
8     *      summary="Get list of projects",
9     *      description="Returns list of projects",
10     *      @OA\Response(
11     *          response=200,
12     *          description="Successful operation",
13     *          @OA\JsonContent(ref="#/components/schemas/ProjectResource")
14     *       ),
15     *      @OA\Response(
16     *          response=401,
17     *          description="Unauthenticated",
18     *      ),
19     *      @OA\Response(
20     *          response=403,
21     *          description="Forbidden"
22     *      )
23     *     )
24     */
25    public function index()
26    {
27        abort_if(Gate::denies('project_access'), Response::HTTP_FORBIDDEN, '403 Forbidden');
28
29        return new ProjectResource(Project::with(['author'])->get());
30    }