GuavaCZ / calendar

MIT License
140 stars 13 forks source link

[Question]: Use page instead widget #19

Closed aeq-dev closed 4 months ago

aeq-dev commented 4 months ago

What feature would you like to add?

Hello, Can we use a custom page instead of widget ? I want to set a side area for resources items for example, something like this Fullcalendar Thanks :)

Notes

No response

lukas-frey commented 4 months ago

Just render the widget in your custom page

https://filamentphp.com/docs/3.x/widgets/adding-a-widget-to-a-blade-view

aeq-dev commented 4 months ago

Thanksss :)))

PrasadChinwal commented 3 months ago

@lukas-frey how can I access the model record in the calendar widget. Ex.

namespace App\Filament\Resources\InstructorResource\Pages;

use App\Filament\Resources\InstructorResource; use Filament\Actions; use Filament\Resources\Pages\ViewRecord;

class InstructorCalendar extends ViewRecord { protected static string $resource = InstructorResource::class;

protected static string $view = 'filament.pages.instructor-calendar';

}


- `filament.pages.instructor-calendar` blade view for the page
```php
<div>
    @livewire(\App\Livewire\InstructorSchedule::class)
</div>

namespace App\Livewire;

use Filament\Tables\Actions\Concerns\InteractsWithRecords; use Guava\Calendar\Widgets\CalendarWidget; use Illuminate\Support\Collection;

class InstructorSchedule extends CalendarWidget { use InteractsWithRecords;

public function getEvents(array $fetchInfo = []): Collection|array
{
    return [];
}

}



My page is accessible at url `https://app.com/instructors/3/calendar` and I want to access the instructors record using the route id in the url so I can fetch the instructors schedule.
lukas-frey commented 3 months ago

Add public ?Model $record = null;to the widget

PrasadChinwal commented 3 months ago

@lukas-frey Unfortunately I have already tried this and I get null when I dump the $record in the getEvents method.