*/ class ApiKeyFactory extends Factory { protected $model = ApiKey::class; public function definition(): array { return [ 'tenant_id' => Tenant::factory(), 'user_id' => User::factory(), 'name' => 'API-ключ', 'key_hash' => Hash::make(Str::random(48)), 'key_prefix' => 'lpkapi_'.Str::lower(Str::random(3)), 'scopes' => ['read'], 'last_used_at' => null, 'expires_at' => now()->addYear(), 'is_active' => true, 'created_at' => now(), ]; } }