id name date1 date2
1 a 2010-01-01 2010-01-02
2 b 2010-01-01 2010-01-02
.
.
.
and i have a form, so user can input based on name, date1, or date2..
user can no fill up name,date1, or date2
my query like this
DB::table('myTable)->where('myTable.name', 'like', '%'.$inputName.'%')->where('myTable.date1', $inputDate1)->where('myTable.date2', $inputDate2)->get();
Need some context. Any errors? date1 and date2 database types? Wrong output? $inputDate1 and $inputDate2 formats? Log the query and paste here full SQL query. Leverage Carbon.
Put the following code in boot method in your AppServiceProvider, then paste the output from the laravel.log file:
@crnkno
i got wrong output..
$inputDate1 and $inputDate2 formats like this = "2017-10-28"
i try use whereDate() but still go wrong input.. my conditin like this user can fill up or no fill up name, date1, or date2.. user can input 1 condition like only name or 2 condition like name and date1