Fix team authorization, invite revocation, and slug handling
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Team;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/** @extends Factory<Team> */
|
||||
class TeamFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
$name = fake()->unique()->company();
|
||||
|
||||
return [
|
||||
'name' => $name,
|
||||
'slug' => Str::slug($name),
|
||||
'require_2fa' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\TeamInvite;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/** @extends Factory<TeamInvite> */
|
||||
class TeamInviteFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'team_id' => TeamFactory::new(),
|
||||
'invited_by_user_id' => UserFactory::new(),
|
||||
'invited_email' => fake()->unique()->safeEmail(),
|
||||
'invite_token' => hash('sha256', Str::random(128)),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user