I get 2 numbers made through withCount in my Eloquent query result. Is there any way to multiply/divide/add these 2 numbers and make a new field?
$data = Trek::select('name')
->withCount('past_bookings')
->withCount('bookings')
->get();
(Like ->select(DB::raw('past_bookings*bookings as new_col'))??)
When I used an accessor, I got Call to a member function addEagerConstraints() on int error.