omnia-digital / livewire-calendar

Laravel Livewire component to show Events in a good looking monthly calendar
MIT License
68 stars 7 forks source link

Not Working #12

Closed swartjie closed 6 months ago

swartjie commented 11 months ago

Hey Guys,

I have a laravel 10 project running PHP 8.1 and I included your version of the livewire-calendar (after seeing the original is not being maintained).

I just can't get it to display anything. I have followed the steps word for word, and it's not throwing an error, but it's not actively doing anything... Can you please advise what might be the issue or where to start looking?

My Component looks like this:

<?php

namespace App\Http\Livewire;

use Livewire\Component;
use Omnia\LivewireCalendar\LivewireCalendar;
use Illuminate\Support\Collection;

class AppointmentsCalendar extends LivewireCalendar
{
    public function events() : Collection
    {
        return collect([
            [
                'id' => 1,
                'title' => 'Breakfast',
                'description' => 'Pancakes! 🥞',
                'date' => Carbon::today(),
            ],
            [
                'id' => 2,
                'title' => 'Meeting with Pamela',
                'description' => 'Work stuff',
                'date' => Carbon::tomorrow(),
            ],
        ]);
    }

    public function render()
    {
        return view('livewire.appointments-calendar');
    }
}

and the blade for the dashboard page:

<div>
    <!--suppress HtmlUnknownTag -->
    {{--<x-slot name="header">Dashboard</x-slot>--}}
    <div class="py-4 space-y-4">
        <livewire:appointments-calendar/>
    </div>
</div>

Any assistance would be great?

swartjie commented 11 months ago

Hate to be that guy, But solved the issue by looking into the demo file's... Changing the render method to:

    public function render()
    {
        return parent::render();
    }

solved the issue. Not sure how or why. But happy days!

joshtorres commented 6 months ago

So sorry about this! I don't know why but Github never sends me notifications so I just happened to be checking something when I was setting this up in a project and I saw your issue. Thanks for coming back to put the fix! My guess is that you didn't have the omnia calendar component in your child component, but I'm glad you were able to get it working without me. I'll try to figure out this notification issue.