I have a form with a field of type month
, which sends a value in the format Y-m
to my controller. How do I search the records for the selected month and year?
I'm using l5-repository
I did this, but it does not work:
$date = Input::get('date');
$type = Input::get('type');
$values = $this->repository->findWhere(['type' => $type, 'date' => $date]);
Give the following error:
QueryException in Connection.php line 761: SQLSTATE [22007]: Invalid datetime format: 7 ERROR: invalid input syntax for type date: "2016-09" (SQL: select * from "values" where "type" = Recipe and "date" = 2016-09)
I already imagined that I would make this mistake, but I do not know how to make it work. Anyone give a light?
I'm using PostgreSQL database and the date field is in the date
same format.