Roles: Broker vs Investor in Single Panel

Filament 4/5

Role-based registration where users see resources and records based on their selected role. Investors can choose brokers with whom they don't have portfolios yet.

01J211B692KNHQHPPTB5RNG1DM

Get the Source Code:

Only This Example

$9

One-time payment

Full source code for Roles: Broker vs Investor in Single Panel
Downloadable ZIP file with the source code
Lifetime access to this example
GitHub Sign in with GitHub to buy

Sign in first, then complete your $9 checkout.

Best value — all 168 examples

FilamentExamples Membership

$99 /year
or
$199 lifetime
Access to code of all 168 examples
Future new examples and updates included
FilaCheck Pro package licence included
MCP server included
View membership plans

30-day money-back guarantee

How it works

In the Panel Provider we enable registration and pass an action as our own custom registration page.

app/Providers/Filament/AdminPanelProvider.php:

use App\Filament\Pages\Auth\Register;
 
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')
->login()
->registration(Register::class)
// ...
}
}

The registration page must extend the registration page from the Filament. In the register page, we add a radio select field for the role and set the default role to the Broker.

App/Filament/Pages/Auth/Register.php:

use Filament\Schemas\Schema;
use App\Models\Role;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\Field;
use Filament\Forms\Components\Component;
use Filament\Auth\Pages\Register as BaseRegister;
 
class Register extends BaseRegister
{
public function form(Schema $schema): Schema
{
return $schema
->components([
$this->getNameFormComponent(),
$this->getEmailFormComponent(),
$this->getPasswordFormComponent(),
$this->getPasswordConfirmationFormComponent(),
$this->getRoleRadioFormComponent(),
]);
}
 
protected function getRoleRadioFormComponent(): Field
{
return Radio::make('role_id')
->label('Select role')
->required()
->inline()
->exists(Role::class, 'id')
->options(Role::pluck('name', 'id'))
->default(function (Radio $component): int {
return array_search('Broker', $component->getOptions());
});
}
}

The user belongs to a role. Permissions are managed in the Policies by simply checking the user's role name.

The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.