Skip to content

presidenwashil/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

Documentation

  1. Features
  2. Screenshots
  3. Installation
  4. Use Filament Shield
  5. Use Filament Impersonate
  6. Use Laravel Jetstream Teams
  7. Testing
  8. Publish Resource
  9. Register User Relation Manager
  10. User Users Resource Hooks
  11. Use Simple User Resource
  12. Publish Assets
  13. Other Filament Packages

Features

  • Users Resource
  • Allow To Publish User Resource
  • Allow To Use Shield
  • Allow To Use Impersonate
  • Allow To Use Facade Class to custom the current user resource
  • Integration with Laravel Jetstream teams
  • custom User model from config file
  • custom Team model from config file
  • custom Role model from config file
  • Laravel Jetsream user profile page
  • Allow User / Teams Avatars
  • Custom Register/Login Pages for Laravel Jetstream
  • Add OTP Page to Register process

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

Use Laravel Jetstream Teams

you can use the Laravel Jetstream Teams by install it first

composer require laravel/jetstream

now you need to install the jetstream with livewire

php artisan jetstream:install livewire

go to jetstream.php and allow teams feature

'features' => [
//     Features::termsAndPrivacyPolicy(),
//     Features::profilePhotos(),
//     Features::api(),
     Features::teams(['invitations' => true]),
//     Features::accountDeletion(),
],

now you need to publish teams migration from jetstream

php artisan vendor:publish --tag=jetstream-teams-migrations

now you need to migrate the teams migration

php artisan migrate

now on your filament-users.php config allow shield

/*
 * User Filament Teams
 */
"teams" => true,

now clear your config

php artisan config:cache

Testing

if you like to run PEST testing just use this command

composer test

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

Register User Relation Manager

you can register the user relation manager to your project

use TomatoPHP\FilamentUsers\Facades\FilamentUser;

public function boot()
{
    FilamentUser::register([
        \Filament\Resources\RelationManagers\RelationManager::make() // Replace with your custom relation manager
    ]);
}

User Users Resource Hooks

we have add a lot of hooks to make it easy to attach actions, columns, filters, etc

Table Columns

use TomatoPHP\FilamentUsers\Resources\UserResource\Table\UserTable;

public function boot()
{
    UserTable::register([
        \Filament\Tables\Columns\TextColumn::make('something')
    ]);
}

Table Actions

use TomatoPHP\FilamentUsers\Resources\UserResource\Table\UserActions;

public function boot()
{
    UserActions::register([
        \Filament\Tables\Actions\ReplicateAction::make()
    ]);
}

Table Filters

use TomatoPHP\FilamentUsers\Resources\UserResource\Table\UserFilters;

public function boot()
{
    UserFilters::register([
        \Filament\Tables\Filters\SelectFilter::make('something')
    ]);
}

Table Bulk Actions

use TomatoPHP\FilamentUsers\Resources\UserResource\Table\UserBulkActions;

public function boot()
{
    UserBulkActions::register([
        \Filament\Tables\BulkActions\DeleteAction::make()
    ]);
}

From Components

use TomatoPHP\FilamentUsers\Resources\UserResource\Form\UserForm;

public function boot()
{
    UserForm::register([
        \Filament\Forms\Components\TextInput::make('something')
    ]);
}

Page Actions

use TomatoPHP\FilamentUsers\Resources\UserResource\Actions\ManageUserActions;
use TomatoPHP\FilamentUsers\Resources\UserResource\Actions\EditPageActions;
use TomatoPHP\FilamentUsers\Resources\UserResource\Actions\ViewPageActions;
use TomatoPHP\FilamentUsers\Resources\UserResource\Actions\CreatePageActions;

public function boot()
{
    ManageUserActions::register([
        Filament\Actions\Action::make('action')
    ]);
    
    EditPageActions::register([
        Filament\Actions\Action::make('action')
    ]);
    
    ViewPageActions::register([
        Filament\Actions\Action::make('action')
    ]);
    
    CreatePageActions::register([
        Filament\Actions\Action::make('action')
    ]);
}

Infolist Entries

use TomatoPHP\FilamentUsers\Resources\UserResource\Infolist\UserInfolist;

public function boot()
{
    UserInfolist::register([
       \Filament\Infolists\Components\TextEntry::make('something')
    ]);
}

Use Simple User Resource

you can use the simple user resource by change on config, on your filament-users.php config allow simple

/**
 * ---------------------------------------------
 * Use Simple Resource
 * ---------------------------------------------
 * change the resource from pages to modals by allow simple resource.
 */
'simple' => true,

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

About

User Table Resource with a lot of packages integrations

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%