承接 messerli90/teamwork 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

messerli90/teamwork

Composer 安装命令:

composer require messerli90/teamwork

包简介

User to Team associations with invitation system for Laravel

README 文档

README

Latest Version on Packagist Build Status Quality Score Total Downloads

Teamwork adds User - Team association with an invite system to your Laravel App

Installation

You can install the package via composer:

composer require messerli90/teamwork

Configuration

To publish Teamwork's configuration file, run:

php artisan vendor:publish --provider="Messerli90\Teamwork\TeamworkServiceProvider" --tag=config

This will create config/teamwork.php. The default configuration should work just fine for you, but if you need to change the table / model names you should do that here. The config also supplies an array of possible roles a teammember can have, which can be changed.

Migrations

Run the migration command to generate all tables needed for Teamwork. If your users or teams are not stored in users and teams tables be sure to modify the the config/teamwork.php configuration.

php artisan migrate

After the migration, 2 new tables will be created:

  • team_user -- pivot table that stores a many-to-many relation between teams and their (users) members. Also includes a 'roles' column, defaults to: member.
  • team_invites -- stores pending invites between teams and email addresses.

Usage

Teamwork Facade

You can invite a User to a Team either by passing the User model, or an email address

Teamwork::inviteToTeam($user, $team, callable $success)

Check if the given user or email address has a pending invite for the provided Team

Teamwork::hasPendingInvite($user, $team) // bool

Get instance of Invite model from accept / deny token

Teamwork::getInviteFromAcceptToken($token)
Teamwork::getInviteFromDenyToken($token)

Accept / Deny Invite

Teamwork::acceptInvite(TeamInvite $invite)
Teamwork::denyInvite(TeamInvite $invite)

Team - HasMembers trait

Create your own Team model and add the HasMembers. Trait adds relation for invites, users, owner.

<?php
use Messerli90\Teamwork\HasMembers;

class Team extends Model {
    use HasMembers;
}

Determine if a User is part of Team

$team = App\Team::find(1);
$user = App\User::find(2);

$team->hasUser($user); // bool

User - HasTeams trait

Add the HasTeams trait to your User model. Trait adds relation for teams, ownedTeams, invites.

<?php
use Messerli90\Teamwork\HasTeams;

class User extends Authenticatable {
    use HasTeams;
}

Check if User owns any team, or provided team

$user = App\User::find(1);

// Owns ANY team
$user->ownsTeam(); // bool

// Owns provided team
$team = App\Team::find(1);
$user->ownsTeam($team); // bool

Attach User to Team

$user = App\User::find(1);
$team = App\Team::find(1);
$role = 'member' // Default allowed roles: member, owner, admin, moderator

$user->attachTeam($team, $role);

Detach User from Team

$user = App\User::find(1);
$team = App\Team::find(1);

$user->detachTeam($team);

Switch User's role

$user = App\User::find(1);
$team = App\Team::find(1);

$user->switchRole($team, 'moderator')

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email michaelamesserli@gmail.com instead of using the issue tracker.

Credits

Special Thanks

This package used mpociot/teamwork as a starting point.

License

The MIT License (MIT). Please see License File for more information.

messerli90/teamwork 适用场景与选型建议

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

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