waterdhavian/nova-calendar-tool

Laravel Nova 的日历工具。

1.1.5 2021-02-17 11:16 UTC

This package is auto-updated.

Last update: 2024-09-17 19:34:59 UTC


README

这是一个为 Laravel Nova 设计的包,允许您在日历中创建、更新和删除事件。它还支持 Google 日历集成。

截图

Nova Calendar Tool - screen 1 Nova Calendar Tool - screen 2 Nova Calendar Tool - screen 3

要求

安装

通过 composer 安装包

composer require waterdhavian/nova-calendar-tool

发布迁移

php artisan vendor:publish --provider='Waterdhavian\NovaCalendarTool\ToolServiceProvider' --tag="migrations"

运行迁移

php artisan migrate

NovaServiceProvidertools 方法中注册工具

// app/Providers/NovaServiceProvider.php

// ...

public function tools()
{
    return [
        // ...
        new \Waterdhavian\NovaCalendarTool\NovaCalendarTool,
    ];
}

Google 日历集成

这一步是可选的。如果您想将事件与 Google 日历同步,您需要发布 spatie/laravel-google-calendar 包中的配置文件

php artisan vendor:publish --provider="Spatie\GoogleCalendar\GoogleCalendarServiceProvider"

这将创建以下内容的 config/google-calendar.php 文件

<?php

return [

    /*
     * Path to the json file containing the credentials.
     */
    'service_account_credentials_json' => storage_path('app/google-calendar/service-account-credentials.json'),

    /*
     *  The id of the Google Calendar that will be used by default.
     */
    'calendar_id' => env('GOOGLE_CALENDAR_ID'),
];

所以接下来,您需要将 GOOGLE_CALENDAR_ID=your_id 插入到 .env 文件中(它位于 Google 日历设置页面),并将账户凭据插入到 storage/app/google-calendar/service-account-credentials.json 文件中(您可以从 Google API Console 获取它)。这两件事都已在 这里 解释。

Artisan 命令

将所有事件导出到 Google 日历

php artisan nova-calendar:export

从 Google 日历导入所有事件

php artisan nova-calendar:import

鸣谢

许可证

MIT 许可证 (MIT)。请参阅 LICENSE.md 文件以获取更多信息。