czemu/nova-calendar-tool

Laravel Nova 的日历工具。

1.3.1 2021-08-02 19:10 UTC

This package is auto-updated.

Last update: 2024-09-13 23:56:51 UTC


README

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

截图

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

要求

安装

通过 composer 安装此包

composer require czemu/nova-calendar-tool

发布迁移

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

运行迁移

php artisan migrate

发布配置(可选)

php artisan vendor:publish --provider='Czemu\NovaCalendarTool\ToolServiceProvider' --tag="config"

NovaServiceProvidertools 方法中注册工具

// app/Providers/NovaServiceProvider.php

// ...

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

Google Calendar 集成

这一步是可选的。如果您想将事件同步到 Google Calendar,您必须发布 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'),
];

因此,接下来,您必须在 .env 文件中插入 GOOGLE_CALENDAR_ID=your_id(它在 Google Calendar 设置页面中),并将账户凭据放入 storage/app/google-calendar/service-account-credentials.json 文件中(您可以从 Google API Console 获取它)。这两件事都在 这里 解释。

Artisan 命令

将所有事件导出到 Google Calendar

php artisan nova-calendar:export

从 Google Calendar 导入所有事件

php artisan nova-calendar:import

鸣谢

许可

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