. */ namespace Database\Factories; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; use App\AccountRecoveryToken; use App\Http\Controllers\Account\AuthenticateController as WebAuthenticateController; use Illuminate\Support\Carbon; class AccountRecoveryTokenFactory extends Factory { protected $model = AccountRecoveryToken::class; public function definition() { return [ 'pn_provider' => $this->faker->uuid(), 'pn_param' => $this->faker->uuid(), 'pn_prid' => $this->faker->uuid(), 'token' => Str::random(WebAuthenticateController::$emailCodeSize), 'used' => false, 'ip' => $this->faker->ipv4(), 'user_agent' => $this->faker->userAgent(), 'created_at' => Carbon::now() ]; } public function expired() { return $this->state(fn (array $attributes) => [ 'created_at' => Carbon::now()->subMinutes(1000) ]); } }