<?php

namespace App\Http\Controllers\api;

use App\Http\Controllers\Controller;
use App\Models\Category;
use App\Traits\BaseApiResponse;
use Illuminate\Http\Request;

class CategoriesController extends Controller
{
    use BaseApiResponse;

    public function index(Request $request)
    {   
        $perPage = $request->input('per_page', 15);
        $page = $request->input('page', 1);

        $categories = Category::paginate($perPage, ['*'], 'page', $page);

        
        return $this->success($categories->items());
    }
}
