Skip to content

Commit

Permalink
Merge pull request #169 from Sjoerd24/3.x
Browse files Browse the repository at this point in the history
Feature: added support for resourceId
  • Loading branch information
saade authored Mar 28, 2024
2 parents 00784bb + 6e9c9e2 commit add3ac2
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/Data/EventData.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class EventData implements Arrayable

protected int|string|null $groupId = null;

protected int|string|null $resourceId = null;

protected ?array $resourceIds = null;

protected bool $allDay = false;

protected DateTimeInterface|string $start;
Expand Down Expand Up @@ -59,7 +63,26 @@ public function groupId(int|string $groupId): static
}

/**
* 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.
* 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 $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.
*/
public function allDay(bool $allDay = true): static
{
Expand Down Expand Up @@ -168,6 +191,8 @@ public function toArray(): array
'start' => $this->start,
'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 add3ac2

Please sign in to comment.