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\Resources\UserResource\Table\UserTable;
public function boot()
{
UserTable::register([
\Filament\Tables\Columns\TextColumn::make('something')
]);
}
use TomatoPHP\FilamentUsers\Resources\UserResource\Table\UserActions;
public function boot()
{
UserActions::register([
\Filament\Tables\Actions\ReplicateAction::make()
]);
}
use TomatoPHP\FilamentUsers\Resources\UserResource\Table\UserFilters;
public function boot()
{
UserFilters::register([
\Filament\Tables\Filters\SelectFilter::make('something')
]);
}
use TomatoPHP\FilamentUsers\Resources\UserResource\Table\UserBulkActions;
public function boot()
{
UserBulkActions::register([
\Filament\Tables\BulkActions\DeleteAction::make()
]);
}
use TomatoPHP\FilamentUsers\Resources\UserResource\Form\UserForm;
public function boot()
{
UserForm::register([
\Filament\Forms\Components\TextInput::make('something')
]);
}
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')
]);
}
use TomatoPHP\FilamentUsers\Resources\UserResource\Infolist\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\Form\UserForm::class
],
'infolist' => [
'class' => \TomatoPHP\FilamentUsers\Resources\UserResource\InfoList\UserInfoList::class
],
'pages' => [
'list' => \TomatoPHP\FilamentUsers\Resources\UserResource\Actions\ManageUserActions::class,
'create' => \TomatoPHP\FilamentUsers\Resources\UserResource\Actions\CreatePageActions::class,
'edit' => \TomatoPHP\FilamentUsers\Resources\UserResource\Actions\EditPageActions::class,
'view' => \TomatoPHP\FilamentUsers\Resources\UserResource\Actions\ViewPageActions::class
]
]
/**
* ---------------------------------------------
* Use Simple Resource
* ---------------------------------------------
* change the resource from pages to modals by allow simple resource.
*/
'simple' => true,