7 months ago

Laravel not executing queries with 'DATEDIFF'

Posted 7 months ago by bekaskaki

I'm a noob in Laravel. Can anyone help me write this query in eloquent. I have test this query on navicat and it works, but in laravel controller doesn't work perfectly/different results.

my controller :

''' public function index()


    $title = $this->title;


    $data = DB::select('SELECT * ,IF(DATEDIFF(STR_TO_DATE(tgl_selesai, "$tgl")), CURDATE())      
    <=0,"Berakhir","Masih Berjalan") status FROM data_kerjasama');

    return view('admin.'.$title.'.index', compact('title','data'));



any can help me?

Please sign in or create an account to participate in this conversation.