1. Go to this page and download the library: Download tomatophp/filament-users library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Illuminate\Foundation\Auth\User as Authenticatable;
use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable
{
use HasRoles;
// ...
}
use TomatoPHP\FilamentUsers\Facades\FilamentUser;
public function boot()
{
FilamentUser::register([
\Filament\Resources\RelationManagers\RelationManager::make() // Replace with your custom relation manager
]);
}
use TomatoPHP\FilamentUsers\Filament\Resources\Users\Tables\UserTable;
public function boot()
{
UsersTable::register([
\Filament\Tables\Columns\TextColumn::make('something')
]);
}
use TomatoPHP\FilamentUsers\Filament\Resources\Users\Tables\UserActions;
public function boot()
{
UserActions::register([
\Filament\Tables\Actions\ReplicateAction::make()
]);
}
use TomatoPHP\FilamentUsers\Filament\Resources\Users\Tables\UserFilters;
public function boot()
{
UserFilters::register([
\Filament\Tables\Filters\SelectFilter::make('something')
]);
}
use TomatoPHP\FilamentUsers\Filament\Resources\Users\Tables\UserBulkActions;
public function boot()
{
UserBulkActions::register([
\Filament\Tables\BulkActions\DeleteAction::make()
]);
}
use TomatoPHP\FilamentUsers\Filament\Resources\Users\Schemas\UserForm;
public function boot()
{
UserForm::register([
\Filament\Forms\Components\TextInput::make('something')
]);
}
use TomatoPHP\FilamentUsers\Filament\Resources\Users\Schemas\UserInfolist;
public function boot()
{
UserInfolist::register([
\Filament\Infolists\Components\TextEntry::make('something')
]);
}
/**
* ---------------------------------------------
* Resource Building
* ---------------------------------------------
* if you want to use the resource custom class
*/
'resource' => [
'table' => [
'class' => \TomatoPHP\FilamentUsers\Resources\UserResource\Table\UserTable::class,
'filters' => \TomatoPHP\FilamentUsers\Resources\UserResource\Table\UserFilters::class,
'actions' => \TomatoPHP\FilamentUsers\Resources\UserResource\Table\UserActions::class,
'bulkActions' => \TomatoPHP\FilamentUsers\Resources\UserResource\Table\UserBulkActions::class,
],
'form' => [
'class' => \TomatoPHP\FilamentUsers\Resources\UserResource\Schemas\UserForm::class
],
'infolist' => [
'class' => \TomatoPHP\FilamentUsers\Resources\UserResource\Schemas\UserInfolist::class
]
]
/**
* ---------------------------------------------
* Use Simple Resource
* ---------------------------------------------
* change the resource from pages to modals by allow simple resource.
*/
'simple' => true,