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(); } 

my table structure

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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -