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!
Solution:Jump to solution
Okay I was able to achieve this using https://filamentphp.com/docs/3.x/forms/validation#custom-rules
1 Reply
Solution
Okay I was able to achieve this using https://filamentphp.com/docs/3.x/forms/validation#custom-rules