PHP code example of alfasix / alfakit-calendar

1. Go to this page and download the library: Download alfasix/alfakit-calendar library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alfasix / alfakit-calendar example snippets


use AlfaSix\AlfakitCalendar\CalendarPlugin;

$panel->plugin(CalendarPlugin::make()->editable());

use AlfaSix\AlfakitCalendar\Event;
use AlfaSix\AlfakitCalendar\Widgets\CalendarWidget;

class MeetingsCalendar extends CalendarWidget
{
    protected static ?string $model = Meeting::class;

    protected static ?string $startAttribute = 'starts_at';

    protected static ?string $endAttribute = 'ends_at';

    public function fetchEvents(array $info): array
    {
        return Meeting::query()
            ->whereBetween('starts_at', [$info['start'], $info['end']])
            ->get()
            ->map(fn (Meeting $meeting) => Event::make($meeting)
                ->title($meeting->subject)
                ->start($meeting->starts_at)
                ->end($meeting->ends_at))
            ->all();
    }

    public function getFormSchema(): array
    {
        return [
            TextInput::make('subject')->