Once you create a Filament User resource - you will get a typical user creation form, which will instantly create a new user. What if you want to send an invitation first and allow the User to join from an email? You can do that, too, but there is some custom work needed.

Let's build an invitation System for our Filament!
Setup
Our project setup includes the following:
- Fresh Laravel project
- Filament installation
- Filament setup
Next, we will work on the default User model and resource.
Creating User Resource
We have to create our User resource to manage our Users. Let's do this:
php artisan make:filament-resource User --generate
Create Invitation Model and Database tables
Let's create our migration:
Migration
Schema::create('invitations', function (Blueprint $table) { $table->id(); $table->string('email'); $table->timestamps();});
Then, we can fill our Model:
app/Models/Invitation.php
class Invitation extends Model{ protected $fillable = [ 'email', ];}
As you can see from the setup, it's a pretty basic Model. All we care about - is the email address being invited.
Modify UserResource Create Button Action - to Invite the User
Next on our list, we need to modify the User Create button. We don't want to create the User right away. We want to invite them via email first. So let's...
Premium Members Only
This advanced tutorial is available exclusively to Laravel Daily Premium members.
Already a member? Login here
Premium membership includes:
Did some small changes in my invite, made a check first if the user allready exist, and change the create to updateOrCreate, so I don't end up with the same email multiple times in the database
Altso added roles, so in App/Livewire/AcceptInvitation.php I changed the line on create to
Thank you for this! For the unique check I just use this one liner:
in the Add E-Mail Form
In one of your classes you created a step two login. My question is can that be done with filament as well? And if so; can you create a tutorial showing us how to do it?
Can you expand on this and point to the lesson you are referring?
By the way, Filament login is just a basic login page out of the box. You can go in and customise it however you need!
Ive upgraded Laravel 9 to Laravel 10 and installed Filament, set up User Resource etc and started to follow your tutorial with swapping the User Resource button to Invite.
Adding the routes/web.php code is throwing the following:
https://flareapp.io/share/v5pxA0E5
Did you import the route? Also, maybe the upgrade path made something different - I'm not sure.
The top of my routes/web.php:
Hmm, not sure what could be wrong here. Are you on livewire 3?
Livewire 3.2.6 and Filament 3.1.15
Just doing some googling now and will get back to you if I figure it out
Found the problem: My Model had a typo in the name, so it was throwing a type error
Question can this be done using a Role? Say you are hiring someone and want them to fill out a different Registration form that has different questions related to the job that they are being hired for.
And if so can you give an example for us?
To achieve this, you simply add the role to your invitation table. From there, it's as simple as displaying different form fields for each of the roles.
Not sure if this is worth covering as it is very simple..