why aren't you just using
public function getNameAttribute() {
return $this->event->name;
}
this will load the event relation and get it immediatly, so you can access the name property directly
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community