<?php

namespace App\Http\Controllers\V3\WebServices;

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

class RoadItemController extends Controller
{
    use ApiResponse;
    public function index(IndexRequest $request): JsonResponse
    {
        $fromDate = $request->from_date;
        $toDate = $request->to_date;
        $roadItems = RoadItemsProject::query()
            ->where('is_new', '=', 1)
            ->whereBetween('activity_date_time', [$fromDate, $toDate])
            ->get();

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