Add application API keys
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\UserApplication;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<UserApplication>
|
||||
*/
|
||||
class UserApplicationFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$plainTextKey = UserApplication::generatePlainTextKey();
|
||||
|
||||
return [
|
||||
'key_hash' => UserApplication::hashKey($plainTextKey),
|
||||
'last_used_at' => null,
|
||||
'name' => fake()->words(2, true),
|
||||
'user_id' => User::factory(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user