30 lines
734 B
PHP
30 lines
734 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Event;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\PhotoboothConnectCode>
|
|
*/
|
|
class PhotoboothConnectCodeFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$rawCode = str_pad((string) $this->faker->numberBetween(0, 999999), 6, '0', STR_PAD_LEFT);
|
|
|
|
return [
|
|
'event_id' => Event::factory(),
|
|
'code_hash' => hash('sha256', $rawCode),
|
|
'expires_at' => now()->addMinutes(10),
|
|
'redeemed_at' => null,
|
|
];
|
|
}
|
|
}
|