Back to MyCalendar Support

marcoelho977747
marcoelho977747

Hello, once again.

I have been somewhat adapting the plugin to my needs, and, I found out that this component collects the slug, and looks for the ID in the events. Only. It should also look for it in the ocurrences. So, my own fix was for the slug to be the occurrence id, and then, in the component 'Event', you would search for the ocurrence, and find the event's info with that ocurrence's "event_id". Like so:


    public function loadEvent()
    {
        $slug = $this->property('slug');
        $this->calOccur = MyOccurrences::find($slug);
        if ($this->usePermissions) {

            $query = MyEvents::withOwner()
                ->permisions(
                    $this->userId(),
                    [Settings::get('public_perm')],
                    Settings::get('deny_perm')
                );
        } else {
            $query = MyEvents::withOwner();
        }

        $this->calEvent = $query->with('categorys')
             ->where('is_published', true)
             ->find($this->calOccur->event_id);

        if (!$this->calEvent) {
            return $this->page['ev'] = ['name' => Lang::get('kurtjensen.mycalendar::lang.event.error_not_found'), 'cats' => []];
        }
        return $this->page['ev'] = [
            'occur_date'=> $this->calOccur->start_at->toDateTimeString(),
            'name' => $this->calEvent->name,
            'date' => $this->calEvent->date->format(Settings::get('date_format', 'F jS, Y')),
            'time' => $this->calEvent->human_time,
            'link' => $this->calEvent->link ? $this->calEvent->link : '',
            'text' => $this->calEvent->text,
            'cats' => $this->calEvent->categorys->lists('name'),
            'owner_name' => $this->calEvent->owner_name,
            'data' => $this->calEvent,
        ];
    }

Notice I only call the "Occur_date" in the EV variables because that's the only data that changes throughout the occurrences of the same event.

1-1 of 1