PHP code example of marshmallow / nova-calendar

1. Go to this page and download the library: Download marshmallow/nova-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/ */

    

marshmallow / nova-calendar example snippets


namespace App\Providers;

use App\Nova\SomeEvent;
use App\Nova\User;
use Marshmallow\NovaCalendar\DataProvider\AbstractCalendarDataProvider;

class CalendarDataProvider extends AbstractCalendarDataProvider
{
    public function novaResources(): array
    {
        return [
            // Single-day event on the model's `created_at` timestamp:
            User::class => 'created_at',

            // Event with a start and (optionally nullable) end timestamp:
            SomeEvent::class => ['starts_at', 'ends_at'],
        ];
    }
}

use Marshmallow\NovaCalendar\NovaCalendar;

public function tools(): array
{
    return [
        new NovaCalendar('my-calendar'),
    ];
}

use Laravel\Nova\Menu\MenuItem;
use Marshmallow\NovaCalendar\NovaCalendar;

MenuItem::link(__('Calendar'), NovaCalendar::pathToCalendar('my-calendar'));

use App\Calendar\Providers\BirthdayDataProvider;
use App\Calendar\Providers\FlightDataProvider;

return [
    'flights' => [
        'dataProvider' => FlightDataProvider::class,
        'uri' => 'calendar/flights',
    ],
    'birthdays' => [
        'dataProvider' => BirthdayDataProvider::class,
        'uri' => 'calendar/birthdays',
        'windowTitle' => 'Birthdays',
    ],
];
sh
php artisan vendor:publish --provider="Marshmallow\NovaCalendar\ToolServiceProvider" --tag="config"