<?php

namespace App\Http\Controllers\V3\Dashboard\RoadItem;

use App\Http\Controllers\Controller;
use App\Http\Requests\V3\RoadItem\WebService\CheckRequest;
use App\Http\Traits\ApiResponse;
use App\Models\RoadItemsProject;
use Illuminate\Http\JsonResponse;

class WebServiceController extends Controller
{
    use ApiResponse;
    public function getRoadItem(CheckRequest $request): JsonResponse
    {
        $fromDate = $request->from_date;
        $toDate = $request->to_date;
        $roadItems = RoadItemsProject::query()
            ->whereBetween('created_at', [$fromDate, $toDate])
            ->get();

        return $this->successResponse($roadItems);
    }
}
