Black Friday: coupon FRIDAY24 for 40% off Yearly/Lifetime membership! Read more here

Filament: User Registration by Email Invitations

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...

The full tutorial [6 mins, 1140 words] is only for Premium Members

Login Or Become a Premium Member for $129/year or $29/month
What else you will get:
  • 67 courses (1172 lessons, total 43 h 18 min)
  • 90 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord

Recent New Courses