I'm very new to Laravel and don't quite understand the DB::table
method in conjuction with an AND
clause.
So I have this query at the moment:
$query = DB::select( DB::raw("SELECT * FROM tablethis WHERE id = '$result' AND type = 'like' ORDER BY 'created_at' ASC"));
It is working, but I'd like to use Laravel's Query Builder to produce something like:
$query = DB::table('tablethis')->where('id', '=', $result)->where('type', '=', 'like')->orderBy('created_at', 'desc')
But this seems to ignore the second where()
completely. So, basically how do I make this work?