3.1-3.6: install l5-swagger, add @OA annotations to all controllers

This commit is contained in:
parsa aghaei committed 2026-06-23 18:34:20 +03:30
1 parent db7ce880a0
commit afb202f333
13 files changed
+1367 -73

No files matched your search

@@ -5,8 +5,20 @@ namespace App\Http\Controllers\Api\Website;
use App\Http\Controllers\Controller;
use App\Models\Website\Service;
/**
* @OA\Tag(name="Services", description="Services section endpoints")
*/
class ServiceController extends Controller
{
/**
* @OA\Get(
* path="/website/services/{locale}",
* tags={"Services"},
* summary="List all services in a given locale",
* @OA\Parameter(name="locale", in="path", required=true, @OA\Schema(type="string", enum={"fa","en"})),
* @OA\Response(response=200, description="OK", @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/Service")))
* )
*/
public function index($locale)
{
$services = Service::all();
@@ -26,6 +38,16 @@ class ServiceController extends Controller
return response()->json($response);
}
/**
* @OA\Get(
* path="/website/services/{id}/translation/{locale}",
* tags={"Services"},
* summary="Get a single service translation",
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
* @OA\Parameter(name="locale", in="path", required=true, @OA\Schema(type="string", enum={"fa","en"})),
* @OA\Response(response=200, description="OK")
* )
*/
public function showTranslation($id, $locale)
{
$service = Service::findOrFail($id);