@theone you might need to put get() on your method:
public function getServices()
{
return Services::whereIn('id',explode(',',$this->extra_service))->get();
}
Also, try calling it like this:
Booking::with('getServices')->get();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm having Two table Booking and services i'm getting all bookings like Booking::get()->load('getServices'); In my booking model , public function getServices() { return Services::whereIn('id',explode(',',$this->extra_service)); } i saved selected service ids in comma separated in the field extra_service ,Please someone help to slove this
Please or to participate in this conversation.