FilamentF
Filament3y ago
Jay

Custom registration

Hi guys, I created a custom register page as per the documentation here
https://filamentphp.com/docs/3.x/panels/users#customizing-the-authentication-features

Here's the code:

<?php

namespace App\Filament\Pages\Auth;

use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Pages\Auth\Register as BaseRegister;

class Register extends BaseRegister
{
public function form(Form $form): Form
{
return $form
->schema([
$this->getNameFormComponent(),
$this->getEmailFormComponent(),
TextInput::make('faculty_code')
->required()
->maxLength(255),
$this->getPasswordFormComponent(),
$this->getPasswordConfirmationFormComponent(),
]);
}
}

Question is, how do I run validations on the faculty code field? It should be a valid code (that exists in the faculties table). Would appreciate if someone can point me in the right direction. Thank you!
Was this page helpful?