i have a problem with a raw SQL-select. This Code works in Laravel 5.2:
$massage = DB::table('course') ->select(DB::raw("*, (SELECT COUNT(*) FROM appointments WHERE p ='x' AND appointments.id = course.id GROUP BY A_id ) as fp, ... ... "))->get();
I've got a value for the the variable "fp".
With Laravel 5.5 the value "fp" is empty.
With the raw-select the get and set attributes in the model doesn't work, too.
For a better understanding: I have a table with sport courses. The table course has a many relation to the table appointments. I need the count of the booked appointments.
How can i solve my problem?
Best regards Markus
Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.