tomatophp/filament-users

拥有大量包集成的用户表资源

资助包维护!
3x1io

v1.0.12 2024-09-17 16:47 UTC

This package is auto-updated.

Last update: 2024-09-17 16:47:44 UTC


README

Screenshot

Filament 用户

Latest Stable Version License Downloads

拥有大量包集成的用户表资源

对于 v2 版本,请使用此 仓库

屏幕截图

Users List Edit User Users Filters

安装

composer require tomatophp/filament-users

最后在 /app/Providers/Filament/AdminPanelProvider.php 上注册插件

->plugin(\TomatoPHP\FilamentUsers\FilamentUsersPlugin::make())

使用 Filament Shield

您可以使用 shield 保护您的资源,并通过安装它来允许用户角色

composer require bezhansalleh/filament-shield

将 Spatie\Permission\Traits\HasRoles 特性添加到您的用户模型中

use Illuminate\Foundation\Auth\User as Authenticatable;
use Spatie\Permission\Traits\HasRoles;

class User extends Authenticatable
{
    use HasRoles;

    // ...
}

发布配置文件后设置您的配置

->plugin(\BezhanSalleh\FilamentShield\FilamentShieldPlugin::make())

现在运行以下命令来安装 shield

php artisan shield:install

现在我们可以发布包资源。

php artisan vendor:publish --tag="filament-users-config"

现在在您的 filament-users.php 配置中允许 shield

/*
 * User Filament Shield
 */
"shield" => true,

现在清除您的配置

php artisan config:cache

有关更多信息,请参阅 Filament Shield

使用 Filament Impersonate

您可以通过安装它来使用 impersonate 来模仿用户

composer require stechstudio/filament-impersonate

现在在您的 filament-users.php 配置中允许 shield

/*
 * User Filament Impersonate
 */
"impersonate" => true,

现在清除您的配置

php artisan config:cache

有关更多信息,请参阅 Filament Impersonate

发布资源

您可以将资源发布到您的项目中

php artisan filament-users:publish

它将发布资源到您的项目中

然后转到 filament-users.php 配置文件,将 publish_resource 更改为 true

使用 Facade 类

您可以使用 facade 类将任何内容附加到您的用户资源中,例如在提供者中

use TomatoPHP\FilamentUsers\Facades\FilamentUser;

public function boot()
{
    FilamentUser::registerAction(\Filament\Actions\Action::make('update'));
    FilamentUser::registerCreateAction(\Filament\Actions\Action::make('update'));
    FilamentUser::registerEditAction(\Filament\Actions\Action::make('update'));
    FilamentUser::registerFormInput(\Filament\Forms\Components\TextInput::make('text'));
    FilamentUser::registerTableAction(\Filament\Tables\Actions\Action::make('update'));
    FilamentUser::registerTableColumn(\Filament\Tables\Columns\Column::make('text'));
    FilamentUser::registerTableFilter(\Filament\Tables\Filters\Filter::make('text'));
}

发布资源

您可以使用此命令发布配置文件

php artisan vendor:publish --tag="filament-users-config"

您可以使用此命令发布语言文件

php artisan vendor:publish --tag="filament-users-lang"

其他 Filament 包

查看我们的 Awesome TomatoPHP