i have register auth page and i need to do action like
$user = Auth()->user();
$user->assignRole('admin');
in this page
class Register extends BaseRegister
{
protected function getForms(): array
{
return [
'form' => $this->form(
$this->makeForm()
->schema([
$this->getNameFormComponent(),
$this->getEmailFormComponent(),
$this->getPasswordFormComponent(),
$this->getPasswordConfirmationFormComponent(),
])
->statePath('data'),
),
];
}
}
5 Replies
i am use spatie and i need when user register via filament register page assign to it default role any help?
why no someone help me to take register page in filament give the user default role but take in consider i have function to give role not just role field in user model because i used spatie for that,
maybe something like this:
protected function getRoleFormComponent(): Component
{
return Hidden::make('role')->default('user')->required();
}
تقصد كدة يا احمد ولا ايه ؟
From Docu: Please be aware that the value of this field is still editable by the user if they decide to use the browser's developer tools. You should not use this component to store sensitive or read-only information.
ok thanks , i have one question i want to apply multi-lang on table and i decide to make two table one orginal table and other for translate how to apply this in filament or what is the idea for this case ?