adrema/modules/Mailgateway/Models/MailgatewayFactory.php

45 lines
951 B
PHP
Raw Normal View History

2023-06-01 15:02:35 +02:00
<?php
2024-10-24 23:17:23 +02:00
namespace Modules\Mailgateway\Models;
2023-06-01 15:02:35 +02:00
2024-10-24 23:24:21 +02:00
use Modules\Mailgateway\Types\Type;
use Modules\Mailgateway\Types\LocalType;
2023-06-01 15:02:35 +02:00
use Illuminate\Database\Eloquent\Factories\Factory;
/**
2024-10-24 23:17:23 +02:00
* @extends Factory<Mailgateway>
2023-06-01 15:02:35 +02:00
*/
class MailgatewayFactory extends Factory
{
protected $model = Mailgateway::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
return [
'name' => $this->faker->words(5, true),
2024-10-24 22:42:30 +02:00
'type' => new LocalType(),
2023-06-01 15:02:35 +02:00
'domain' => $this->faker->safeEmailDomain(),
];
}
2024-10-24 22:42:30 +02:00
public function type(Type $type): self
2023-06-01 15:02:35 +02:00
{
2024-10-24 22:42:30 +02:00
return $this->state(['type' => $type]);
2023-06-01 15:02:35 +02:00
}
public function name(string $name): self
{
return $this->state(['name' => $name]);
}
public function domain(string $domain): self
{
return $this->state(['domain' => $domain]);
}
}