🏗️Installation

composer require tomatophp/filament-accounts

after installing your package please run this command

php artisan filament-accounts:install

if you are not using this package as a plugin please register the plugin on /app/Providers/Filament/AdminPanelProvider.php

->plugin(\TomatoPHP\FilamentAccounts\FilamentAccountsPlugin::make()
    ->useAccountMeta()
    ->showAddressField()
    ->showTypeField()
    ->useRequests()
    ->useContactUs()
    ->useLoginBy()
    ->useAvatar()
    ->useAPIs()
)

Publish Account Model

you can publish your account model to add other relations or implement some interfaces by using this command

php artisan vendor:publish --tag="filament-accounts-model"

now go to your filament-accounts.php config file and change the model value to the new one.

if you don't find it you can publish it

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

Add Accounts Guard

now you need to add a new guard to your auth.php config like this

<?php

return [
 /*
    * Features of Tomato CRM
    *
    * accounts: Enable/Disable Accounts Feature
    */
    "features" => [
        "accounts" => true,
        "meta" => true,
        "locations" => true,
        "contacts" => true,
        "requests" => true,
        "notifications" => true,
        "loginBy" => true,
        "avatar" => true,
        "types" => true,
        "teams" => true,
        "apis" => true,
        "send_otp" => true,
        "impersonate" => [
            'active'=> true,
            'redirect' => '/app',
        ],
    ],

    /*
     * Accounts Configurations
     *
     * resource: User Resource Class
     */
    "resource" => null,

    /*
     * Accounts Configurations
     *
     * login_by: Login By Phone or Email
     */
    "login_by" => "email",

    /*
     * Accounts Configurations
     *
     * required_otp: Enable/Disable OTP Verification
     */
    "required_otp" => true,

    /*
     * Accounts Configurations
     *
     * model: User Model Class
     */
    "model" => \TomatoPHP\FilamentAccounts\Models\Account::class,

    /*
     * Accounts Configurations
     *
     * guard: Auth Guard
     */
    "guard" => "accounts",


    /**
     * Accounts Relations Managers
     *
     * you can set selected relations to show in account resource
     */
    "relations" => \TomatoPHP\FilamentAccounts\Filament\Resources\AccountResource\Releations\AccountReleations::class,

    /**
     * Accounts Resource Builder
     *
     * you can change the form, table, actions and filters of account resource by using filament-helpers class commands
     *
     * link: https://github.com/tomatophp/filament-helpers
     */
    "accounts" => [
        "form" => \TomatoPHP\FilamentAccounts\Filament\Resources\AccountResource\Forms\AccountsForm::class,
        "table" => \TomatoPHP\FilamentAccounts\Filament\Resources\AccountResource\Tables\AccountsTable::class,
        "actions" => \TomatoPHP\FilamentAccounts\Filament\Resources\AccountResource\Actions\AccountsActions::class,
        "filters" => \TomatoPHP\FilamentAccounts\Filament\Resources\AccountResource\Filters\AccountsFilters::class,
        "pages" =>  \TomatoPHP\FilamentAccounts\Filament\Resources\AccountResource\Pages\AccountPagesList::class,
    ],

    "teams" => [
        "allowed" => false,
        "model" => \TomatoPHP\FilamentAccounts\Models\Team::class,
        "invitation" => \TomatoPHP\FilamentAccounts\Models\TeamInvitation::class,
        "membership" => \TomatoPHP\FilamentAccounts\Models\Membership::class,
        "resource" => \TomatoPHP\FilamentAccounts\Filament\Resources\TeamResource::class,
    ]

];

Last updated