blackcup/invites 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

blackcup/invites

Composer 安装命令:

composer require blackcup/invites

包简介

Package to create invites

README 文档

README

Latest Version on Packagist Total Downloads

This package allows you to send out custom invites. Once an invite has been sent, the recipient receives a Notification with the option to accept or reject the invite. The sender receives a notification when the recipient accepts or rejects the invite. Every invite has a dedicated class to customize the actions that should be performed once the intive is sent, accepted or rejected.

Installation

Via Composer

composer require blackcup/invites

The package will automatically register itself. Run the provided migrations using

php artisan migrate

Example usage

Create a new MakeAdminInvite by running

php artisan make:invite MakeAdminInvite

This will create a new class in app\Invites. Change the code as follows:

<?php

namespace App\Invites;

use BlackCup\Invites\Invite;
use Illuminate\Support\Facades\Auth;

class MakeAdminInvite extends Invite
{
    /**
     * Indicates if accepting the Invite can only be done by an authenticated user.
     *
     * @var bool
     */
    protected $accept_requires_authentication = true;

    /**
     * Execute Invite specific code on accept.
     *
     * @return void
     */
    public function accept()
    {
        $user = Auth::user();
        $user->admin = true;
        $user->save();
    }
}

Once this invite has been accepted by the recipient, the current user's admin field will be set to true.

Next we can send the invite using

$invite = new MakeAdminInvite();
Invites::send($invite, 'We would like to make you admin to our awesome site', 'James Recipient', 'recipient@example.com', 'John Sender', 'sender@example.com');

Resources

Package resources can be published using:

php artisan vendor:publish --provider="BlackCup\Invites\InvitesServiceProvider" [--tag="..."]

(possible tags are config, views, lang)

Customization

If you don't want to use the default routes, set the boolean routes to false in config/invites.php.

Inside your custom Invite class you can override several protected properties to change the behaviour of the Invite:

You can change the notifications to be sent at several steps in the Invite process. Set property to null to disable a notification entirely.

/**
 * The Notification to send to the recipient of the invite.
 *
 * @var string|null Notification class
 */
protected $received_notification = InvitedNotification::class;

/**
 * The Notification to send to the sender when the invite has been accepted.
 *
 * @var string|null Notification class
 */
protected $accepted_notification = InviteAcceptedNotification::class;

/**
 * The Notification to send to the sender when the invite has been rejected.
 *
 * @var string|null Notification class
 */
protected $rejected_notification = InviteRejectedNotification::class;

To require the user to be authenticated before accepting or rejecting an invite, override the following properties:

/**
 * Indicates if accepting the Invite can only be done by an authenticated user.
 *
 * @var bool
 */
protected $accept_requires_authentication = true;

/**
 * Indicates if rejecting the Invite can only be done by an authenticated user.
 *
 * @var bool
 */
protected $reject_requires_authentication = true;

To set a generic text describing your invite:

/**
 * Description of the invite.
 *
 * @var string|null
 */
protected $description = '...';

Change log

Please see the changelog for more information on what has changed recently.

Testing

vendor/bin/phpunit

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email info@blackcup.nl instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.

blackcup/invites 适用场景与选型建议

blackcup/invites 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 03 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「invites」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 blackcup/invites 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 blackcup/invites 我们能提供哪些服务?
定制开发 / 二次开发

基于 blackcup/invites 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-06