<?php

namespace App\Http\Controllers\api;

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

class LawController extends Controller
{
    use BaseApiResponse;

    public function index(Request $request)
    {
        $perPage = $request->input('per_page', 15);
        $page = $request->input('page', 1);
    
        $laws = Law::simplePaginate($perPage, ['*'], 'page', $page);
        
        return $this->success($laws->items(), 'Success');
    }
}
