<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\AgeType;
use Illuminate\Http\Request;

class AgeTypeController extends Controller
{
    public function index(Request $request)
    {
        $user = $request->user();
        $shopId = $user->type_id === 1 ? $request->query('shop_id') : $user->shop_id;

        return AgeType::where('shop_id', $shopId)->orderBy('display_order')->get();
    }
}
