Registration
Tachi Kit supports two ways of getting an account:
- Public sign-up at
/register, if you allow it. - Created by an admin on the Users page. This always works, regardless of the sign-up setting. See User Management.
Turning public sign-up on or off
Section titled “Turning public sign-up on or off”ALLOWS_PUBLIC_REGISTRATION=falseThis maps to config('tachi.registration.public'). When it’s false:
GET /registerreturns 404 (theFortify::registerViewclosure).POST /registerreturns 404 before a user is created (theFortify::createUsersUsingfactory).- Sign-up links disappear. The shared Inertia prop
canRegisterisfalse, and the login page and landing page hide their “Sign up” links.
What happens when someone signs up
Section titled “What happens when someone signs up”app/Actions/Fortify/CreateNewUser.php:
- Validates name, email (unique) and password, using
ProfileValidationRulesandPasswordValidationRules. - Creates the user. The
hashedcast hashes the password, and theGeneratesUserCodetrait assigns a code such asUSR-0042. - Assigns the
userrole (RoleName::User). - Logs
ActivityEvent::UserCreatedwith the new user as the actor (“Created their account”).
Fortify then signs the user in and redirects them to the dashboard.
Customizing
Section titled “Customizing”Collecting extra fields
Section titled “Collecting extra fields”- Add the column in a migration and to
#[Fillable]onApp\Models\User. - Add the input to
resources/js/pages/auth/register.tsx. - Validate and save it in
CreateNewUser::create():
Validator::make($input, [ ...$this->profileRules(), 'company' => ['required', 'string', 'max:255'], 'password' => $this->passwordRules(),])->validate();
$user = User::create([ 'name' => $input['name'], 'email' => $input['email'], 'company' => $input['company'], 'password' => $input['password'],]);Giving new sign-ups a different role
Section titled “Giving new sign-ups a different role”Create the role (a custom role, or a new case on RoleName if it should be a protected system role), then change the assignRole() call in CreateNewUser:
$user->assignRole(Role::query()->firstOrCreate(['name' => 'member']));Invite-only apps
Section titled “Invite-only apps”Keep public registration off and create accounts from the Users page, or build an invitation flow that calls the same User::query()->create() + assignRole() code as UserController::store().