Level 104
Escape it:
DB::raw("SUM(CASE WHEN bookings.bookable_type ='App\\Room' THEN 1 ELSE 0 END) AS countBookedRoomMontly")
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
in my database i have 10 bookings row from 10 i have 8 Bookable_type="App\Room", but i get zero, i think this is b/c the special character "/" . how can i solve this problem
DB::raw("SUM(CASE WHEN bookings.bookable_type ='App\Room' THEN 1 ELSE 0 END) AS countBookedRoomMontly"),
i also try count , but give all not what i nedd
DB::raw("COUNT(CASE WHEN bookings.bookable_type ='App\Room' THEN 1 ELSE 0 END) AS countBookedRoomMontly"),
Any Help
Hmmm. I put three backslashes in my response above... I guess it was escaped
Please or to participate in this conversation.