muarachmann/laravel-invitations

Laravel 邀请函 - 简化邀请函发送

dev-master 2022-07-28 03:15 UTC

This package is auto-updated.

Last update: 2024-09-28 07:56:50 UTC


README

Latest Version on Packagist Total Downloads Build Status CI

这里应该放你的描述。请查看 contributing.md 以查看待办事项列表。

安装

通过 Composer

$ composer require muarachmann/laravel-invitations

用法

安装 laravel Invite Codes 包后,在你的 config/app.php 文件中注册服务提供者

Laravel 5.5 或更高版本可选

'providers' => [
    MuaRachmann\Invitations\InvitationServiceProvider::class,
    MuaRachmann\Invitations\InvitationEventServiceProvider::class,
];

配置包

你可以使用以下命令发布配置文件:这是将在 config/laravel-invitations.php 中发布的文件内容

php artisan vendor:publish --provider="MuaRachmann\Invitations\InvitationServiceProvider" --tag="laravel-invitations-config"

运行此包所需的迁移。如果你需要自定义表,你可以使用以下方式配置它们

php artisan vendor:publish --provider="MuaRachmann\Invitations\InvitationServiceProvider" --tag="laravel-invitations-migrations"

事件

Laravel Invitations 默认包含几个事件 事件

  • MuaRachmann\Invitations\Events\InvitationAccepted
  • MuaRachmann\Invitations\Events\InvitationDeclined
  • MuaRachmann\Invitations\Events\InvitationExpired
  • MuaRachmann\Invitations\Events\InvitationSent

这些事件包含 invitation 模型,因此你可以监听这些事件并采取适当的操作,例如发送欢迎邮件。

EventServiceProvider.php 中包含监听器

use MuaRachmann\Invitations\Events\InvitationAccepted;
use App\Listeners\SendWelcomeEmail;

protected $listen = [
    InvitationAccepted::class => [
        SendWelcomeEmail::class,
    ],
];

SendWelcomeEmail.php

public function handle($invitation)
{
    // send welcome email to user
}

变更日志

请参阅 changelog 了解最近的变化信息。

测试

$ composer test

贡献

请参阅 contributing.md 了解详细信息及待办事项列表。

安全

如果你发现任何安全问题,请通过电子邮件 muarachmann@gmail.com 而不是使用问题跟踪器。

鸣谢

许可

MIT。请参阅 许可文件 了解更多信息。