Hello i am making an API with laravel, everything works fine just now i added date filter to give results from date A to date B. So when i press submit i get this error:
The POST method is not supported for this route. Supported methods: GET, HEAD.
I searched online but all are for web.php file not for api.php this is my code until now:
<form method="POST" action="{{ url('api/outlay') }}"> @csrf @method('GET') <label for="startdate">Start Date</label> <input type="date" name="startdate" id="startdate"/> <label for="enddate">End Date</label> <input type="date" name="enddate" id="enddate"/> <input type="submit" value="Shfaq vlerat"> </form>
This is my api.php route:
Route::get('outlay/{startdate?}/{enddate?}',[GetValuesController::class,'getOutlays']);