1. Go to this page and download the library: Download zquintana/lara-swag library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespace App\Controllers;
use App\Models\User;
use App\Models\Reward;
use ZQuintana\LaraSwag\Annotation\Model;
use Swagger\Annotations as SWG;
class UserController
{
/*
* @SWG\Response(
* response=200,
* description="Returns the rewards of an user",
* @SWG\Schema(
* type="array",
* @Model(type=Reward::class, groups={"full"})
* )
* )
* @SWG\Parameter(
* name="order",
* in="query",
* type="string",
* description="The field used to order rewards"
* )
* @SWG\Tag(name="rewards")
*/
public function fetchUserRewardsAction(User $user)
{
// ...
}
}