I'm making a web app with Laravel and I want to filter elements by creation date. The format I need is yyyy-mm-dd.
This is what I've tried:
Form to pick a date:
<form method="post" action="{{ route('dateFilter',[$subject,$date]) }}">
<input type="date" class="datepicker" name="date" >
<input type="hidden" value="{{ $subject }}" name="subject">
<input class="btn btn-primary submit-date" type="submit" name="submitDate">
</form>
This is the route I created:
Route::get('/view/{subject}/{date}', 'EntryController@filter')->name('dateFilter');
And this is the function on the controller, it just displays the output for now just to get this step done:
public function filter($request){
print_r($request);
}
Right now if I try to pick a date and submit the form I get the following url:
http://localhost/view/LMSG/Tuesday,%2008/10%20?date=2019-10-07&subject=LMSG
What I need to have is something like /view/LMSG/2019-10-07