uccellolabs/filament-tenancy 问题修复 & 功能扩展

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

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

uccellolabs/filament-tenancy

Composer 安装命令:

composer require uccellolabs/filament-tenancy

包简介

Easy way to manage tenancy with Filament.

README 文档

README

Latest Version on Packagist Total Downloads

Filament Tenancy

Easy way to manage tenancy with filament.

Installation

You can install the package via composer:

composer require uccellolabs/filament-tenancy

Configuration

Edit app/Models/User.php and add the following code:

use Uccellolabs\FilamentTenancy\Support\Traits\UserBelongsToTenant;

class User extends Authenticatable
{
    use UserBelongsToTenant;

    protected $fillable = [
        // ...
        'current_tenant_id',
    ];
}

Edit app/Filament/Resources/UserResource/Pages/ListUsers.php and add the following code:

use Uccellolabs\FilamentTenancy\Support\Traits\CurrentTenant;

class ListUsers extends ListRecords
{
    use CurrentTenant;

    protected function getTableQuery(): Builder
    {
        $userIds = $this->getCurrentTenant()?->users()->pluck('users.id') ?? [];

        return User::whereIn('id', $userIds);
    }
}

Usage

use Uccellolabs\FilamentTenancy\Support\Traits\CurrentTenant;

Add a column named tenant_id in your table and add the following code in your Model:

use Uccellolabs\FilamentTenancy\Support\Traits\BelongsToTenant;

class YourModel extends Model
{
    use BelongsToTenant;
}

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固