Skip to content

Commit

Permalink
Update EventData.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjoerd24 committed Mar 23, 2024
1 parent 82fb0e5 commit 5958930
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/Data/EventData.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ class EventData implements Arrayable

protected int|string|null $groupId = null;

protected int|string|array|null $resourceId = null;
protected int|string|null $resourceId = null;

protected ?array $resourceIds = null;

protected bool $allDay = false;

Expand All @@ -32,7 +34,6 @@ class EventData implements Arrayable
protected ?string $textColor = null;

protected ?array $extendedProps = null;

protected array $extraProperties = [];

public static function make(): static
Expand Down Expand Up @@ -64,15 +65,24 @@ public function groupId(int|string $groupId): static
* Events can be associated with a resource when its resourceId property matches one of
* the resource object’s id field
*/
public function resourceId(int|string|array $resourceId): static
public function resourceId(int|string $resourceId): static
{
$this->resourceId = $resourceId;

return $this;
}
/**
* It is also possible to associate an event with multiple resources using the resourceIds property.
*/
public function resourceIds(array $resourceIds): static
{
$this->resourceIds = $resourceIds;

return $this;
}
/**
* Determines if the event is shown in the “all-day” section of relevant views. In addition, if true the time text is not displayed with the event.
* Determines if the event is shown in the “all-day” section of relevant views. In addition,
* if true the time text is not displayed with the event.
*/
public function allDay(bool $allDay = true): static
{
Expand Down Expand Up @@ -182,6 +192,7 @@ public function toArray(): array
'end' => $this->end,
'title' => $this->title,
...$this->resourceId ? ['resourceId' => $this->resourceId] : [],
...$this->resourceIds ? ['resourceIds' => $this->resourceIds] : [],
...$this->url ? ['url' => $this->url, 'shouldOpenUrlInNewTab' => $this->shouldOpenUrlInNewTab] : [],
...$this->groupId ? ['groupId' => $this->groupId] : [],
...$this->allDay ? ['allDay' => $this->allDay] : [],
Expand Down

0 comments on commit 5958930

Please sign in to comment.