id(); $table->foreignId('inviter_id')->constrained('users')->cascadeOnDelete(); $table->string('email'); // Workspace invitations store an OrganizationRole; folder // invitations store a FolderRole. The inviteable type selects // which role vocabulary applies. $table->string('role'); $table->morphs('inviteable'); $table->string('token', 64)->unique(); $table->timestamp('expires_at')->nullable(); $table->timestamp('accepted_at')->nullable(); $table->foreignId('accepted_by_id')->nullable()->constrained('users')->nullOnDelete(); $table->timestamps(); $table->unique(['inviteable_type', 'inviteable_id', 'email']); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('invitations'); } };