Skip to content

tomatophp/filament-users

Repository files navigation

Screenshot

Filament users

Latest Stable Version License Downloads

User Table Resource with a lot of packages integrations

for v2 please use this repo

Screenshots

Users List Edit User Users Filters

Installation

composer require tomatophp/filament-users

finally reigster the plugin on /app/Providers/Filament/AdminPanelProvider.php

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

Use Filament Shield

you can use the shield to protect your resource and allow user roles by install it first

composer require bezhansalleh/filament-shield

Add the Spatie\Permission\Traits\HasRoles trait to your User model(s):

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

class User extends Authenticatable
{
    use HasRoles;

    // ...
}

Publish the config file then setup your configuration:

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

Now run the following command to install shield:

php artisan shield:install

Now we can publish the package assets.

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

now on your filament-users.php config allow shield

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

now clear your config

php artisan config:cache

for more information check the Filament Shield

Use Filament Impersonate

you can use the impersonate to impersonate the user by install it first

composer require stechstudio/filament-impersonate

now on your filament-users.php config allow shield

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

now clear your config

php artisan config:cache

for more information check the Filament Impersonate

Publish Resource

you can publish the resource to your project

php artisan filament-users:publish

it will publish the resource to your project

than go to filament-users.php config file and change the publish_resource to true

Use Facade Class

you can use the facade class to attach anything to your user resource, in your provider like this

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'));
}

Publish Assets

you can publish config file by use this command

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

you can publish languages file by use this command

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

Other Filament Packages

Checkout our Awesome TomatoPHP