File tree Expand file tree Collapse file tree
register/src/Filament/Pages/Auth Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33namespace Boy132 \Register \Filament \Pages \Auth ;
44
5+ use App \Extensions \Captcha \CaptchaService ;
56use Filament \Auth \Pages \Register as BaseRegister ;
67use Filament \Forms \Components \TextInput ;
78use Filament \Schemas \Components \Component ;
9+ use Filament \Schemas \Schema ;
810
911class Register extends BaseRegister
1012{
13+ protected CaptchaService $ captchaService ;
14+
15+ public function boot (CaptchaService $ captchaService ): void
16+ {
17+ $ this ->captchaService = $ captchaService ;
18+ }
19+
20+ public function form (Schema $ schema ): Schema
21+ {
22+ $ components = [
23+ $ this ->getNameFormComponent (),
24+ $ this ->getEmailFormComponent (),
25+ $ this ->getPasswordFormComponent (),
26+ $ this ->getPasswordConfirmationFormComponent (),
27+ ];
28+
29+ if ($ captchaComponent = $ this ->getCaptchaComponent ()) {
30+ $ components [] = $ captchaComponent ;
31+ }
32+
33+ return $ schema
34+ ->components ($ components );
35+ }
36+
37+ private function getCaptchaComponent (): ?Component
38+ {
39+ return $ this ->captchaService ->getActiveSchema ()?->getFormComponent();
40+ }
41+
1142 protected function getNameFormComponent (): Component
1243 {
1344 /** @var TextInput $parent */
You can’t perform that action at this time.
0 commit comments