php - passing variable value into where condition laravel 5.2 -
im trying make condition variable value this.
rekapcontroller@show
public function show($tanggal) { $absen = absen::where('date(created_at)', '=', $tanggal) ->get(); }
but when run code, show error
column not found: 1054 unknown column 'date(created_at)' in 'where clause' (sql: select *
absen
date(created_at)
= 2017-08-17)
thanks
you can used
$absen = absen::where(db::raw("date_format(created_at,'%d/%m/%y')"), '=', $tanggal) ->get();
Comments
Post a Comment