定制 legrisch/statamic-graphql-events 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

legrisch/statamic-graphql-events

Composer 安装命令:

composer require legrisch/statamic-graphql-events

包简介

A Statamic addon that provides a fieldset and the corresponding GraphQL Queries and fields to handle recurring events with ease.

README 文档

README

Statamic GraphQL Events is a Statamic addon that provides a fieldset and the corresponding GraphQL Queries and fields to handle recurring events with ease.

  • GraphQL queries & fields for recurring events
  • Infinitely complex recurrence rules
  • Easy to set up

Index

Install

composer require legrisch/statamic-graphql-events

Setup

This addon assumes that you want to use a single collection and entries of a single blueprint as the source of your events.

  • Run php artisan vendor:publish --tag=statamic.graphql-events --force to publish the configuration along with the provided fieldset "Dates".
  • Add the provided fieldset "Dates" to the blueprints of your events collection. You may translate the fields to your liking, but be sure to keep the handles.
  • Edit the addon configuration: config/statamic/graphql-events.php.
  • Open the GraphiQL Editor.
  • You should see three new queries: eventsAfter, eventsAfterNow and eventsBetween.

How to Use

Concepts

An event may have an arbitrary amount of recurrence rules, however there are two limitations:

  • If an event is not marked as happening "all day", a start time is required.
  • If an event is marked as recurring, a date which defines the end of the recurrence is required.

Queries

Fields and Queries that use dates as an input accept everything that Carbon::parse accepts.

All query results are sorted by the first occurrence in the given timeframe.

eventsAfter

Returns events that have occurrences after a certain date.

Example
query MyQuery {
  eventsAfter(after: "1. April 2022") {
    title
    slug
    occurrencesAfter(after: "1. April 2022") {
      start
    }
  }
}

eventsAfterNow

Returns events that have occurrences after now.

Example
query MyQuery {
  eventsAfterNow {
    slug
    title
    occurrencesAfterNow {
      start
    }
  }
}

eventsBetween

Returns events that have occurrences between two provided dates.

Example
query MyQuery {
  eventsBetween(from: "1. March 2022", to: "1. April 2022") {
    slug
    title
    occurrencesBetween(from: "1. March 2022", to: "1. April 2022") {
      start
    }
  }
}

Fields

Besides the queries, this addon adds fields to the GraphQL type of your entries.

occurrences

Returns the occurrences of an event starting from the first occurrence.

Example
occurrences(limit: 10) {
  start
  end
  allDay
}

occurrencesAfter

Returns the occurrences of an event starting from a provided date.

Example
occurrencesAfter(after: "1. April 2022", limit: 10) {
  start
  end
  allDay
}

occurrencesAfterNow

Returns the occurrences of an event starting from now.

Example
occurrencesAfterNow(limit: 10) {
  start
  end
  allDay
}

occurrencesBetween

Returns the occurrences of an event between two provided dates.

Example
occurrencesBetween(from: "1. March 2022", to: "1. April 2022") {
  start
  end
  allDay
}

License

This project is licensed under the MIT License.

统计信息

  • 总下载量: 22
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-03-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固