Return queried model in Eloquent attribute
问题 I'm using Laravel's eloquent ORM, and I was hoping to be able to return a queried laravel model as an attribute, or more ideally as an eloquent relation. This is what I'm trying to do: class CalendarEvent extends Model { protected $appends = array('conflicts'); public function getConflictsAttribute () { $conflicts = CalendarEvent::where('calendar_event_type','=',$this->calendar_event_type) ->where('start','<',$this->end) ->where('end','>',$this->start) ->get(); return $conflicts; } } This is