To pass an ID to a route, as is common during the display of a single accommodation, the code would be as follows:
/** * Display the specified resource. * @Get("/accommodation/{id}") */
This DocBlock annotation would be placed above the function inside the class, which is similar to the previous example.
To limit the ID to one or more digits, an @Where
annotation can be used as follows:
@Where({"id": "d+"})
Both the annotations are combined together as shown in the following code:
/** * Display the specified resource. * @Get("/accommodation/{id}") * @Where({"id": "d+"}) */
To add middleware to the example, which limits the request to only authenticated users, the @Middleware
annotation may be used:
/** * Display the specified resource. * @Get("/accommodation/{id}") * @Where({"id": "d+"}) * @Middleware("auth") */