PHP code example of warete / moonshine-fullcalendar-resource
1. Go to this page and download the library: Download warete/moonshine-fullcalendar-resource 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/ */
warete / moonshine-fullcalendar-resource example snippets
declare(strict_types=1);
namespace App\MoonShine\Resources;
use App\Models\CalendarEvent;
use MoonShine\Crud\Contracts\Page\DetailPageContract;
use MoonShine\Crud\Contracts\Page\FormPageContract;
use MoonShine\UI\Fields\Color;
use MoonShine\UI\Fields\Date;
use MoonShine\UI\Fields\ID;
use MoonShine\UI\Fields\Text;
use MoonShine\UI\Fields\Textarea;
use Warete\MoonShineFullCalendar\Pages\FullCalendarIndexPage;
use Warete\MoonShineFullCalendar\Resources\FullCalendarResource;
final class CalendarEventsResource extends FullCalendarResource
{
protected string $model = CalendarEvent::class;
protected string $title = 'Calendar Events';
protected string $startColumn = 'start';
protected string $endColumn = 'end';
protected function pages(): array
{
return [
FullCalendarIndexPage::class,
FormPageContract::class,
DetailPageContract::class,
];
}
protected function formFields(): array
{
return [
ID::make()->sortable(),
Text::make('Title', 'title')->
use Illuminate\Database\Eloquent\Model;
use MoonShine\UI\Components\ActionButton;
protected function getCustomCalendarEventActions(Model $item): iterable
{
return [
ActionButton::make('Duplicate', route('events.duplicate', $item))
->primary()
->async(),
];
}
protected function getCalendarEventExtendedProps(Model $item): array
{
return [
'description' => $item->description,
'location' => $item->location,
];
}