v7.0.0-beta.2 release
This commit is contained in:
1 parent
6595fd0eb5
commit
fa8eba7a0d
1165 files changed
+107118
-762127
No files matched your search
@@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\ExtensionOwnerType;
|
||||
use App\Enums\MailSendStatus;
|
||||
use App\Models\MailSendLog;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* 메일 발송 이력 팩토리
|
||||
*
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\MailSendLog>
|
||||
*/
|
||||
class MailSendLogFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* 모델 클래스
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = MailSendLog::class;
|
||||
|
||||
/**
|
||||
* 기본 상태 정의
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'sender_email' => $this->faker->safeEmail(),
|
||||
'sender_name' => $this->faker->name(),
|
||||
'recipient_email' => $this->faker->safeEmail(),
|
||||
'recipient_name' => $this->faker->name(),
|
||||
'subject' => $this->faker->sentence(),
|
||||
'body' => '<p>'.$this->faker->paragraph().'</p>',
|
||||
'template_type' => $this->faker->randomElement(['welcome', 'password_reset', 'new_comment']),
|
||||
'extension_type' => ExtensionOwnerType::Core->value,
|
||||
'extension_identifier' => 'core',
|
||||
'source' => $this->faker->randomElement(['notification', 'test_mail', null]),
|
||||
'status' => MailSendStatus::Sent->value,
|
||||
'error_message' => null,
|
||||
'sent_at' => now(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 발송 실패 상태
|
||||
*/
|
||||
public function failed(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'status' => MailSendStatus::Failed->value,
|
||||
'error_message' => $this->faker->sentence(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 확장 지정
|
||||
*
|
||||
* @param ExtensionOwnerType $type 확장 타입
|
||||
* @param string $identifier 확장 식별자
|
||||
* @return static
|
||||
*/
|
||||
public function forExtension(ExtensionOwnerType $type, string $identifier): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'extension_type' => $type->value,
|
||||
'extension_identifier' => $identifier,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 템플릿 유형 지정
|
||||
*/
|
||||
public function withTemplateType(string $templateType): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'template_type' => $templateType,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\MailTemplate;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* MailTemplate 팩토리
|
||||
*
|
||||
* @extends Factory<MailTemplate>
|
||||
*/
|
||||
class MailTemplateFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* @var string 팩토리 모델 클래스
|
||||
*/
|
||||
protected $model = MailTemplate::class;
|
||||
|
||||
/**
|
||||
* 기본 상태를 정의합니다.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'type' => $this->faker->unique()->slug(2),
|
||||
'subject' => [
|
||||
'ko' => '[테스트] '.$this->faker->sentence(),
|
||||
'en' => '[Test] '.$this->faker->sentence(),
|
||||
],
|
||||
'body' => [
|
||||
'ko' => '<p>'.$this->faker->paragraph().'</p>',
|
||||
'en' => '<p>'.$this->faker->paragraph().'</p>',
|
||||
],
|
||||
'variables' => [
|
||||
['key' => 'name', 'description' => '수신자 이름'],
|
||||
['key' => 'app_name', 'description' => '사이트명'],
|
||||
],
|
||||
'is_active' => true,
|
||||
'is_default' => true,
|
||||
'updated_by' => null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 비활성 상태
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function inactive(): static
|
||||
{
|
||||
return $this->state(fn () => ['is_active' => false]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 유형
|
||||
*
|
||||
* @param string $type 템플릿 유형
|
||||
* @return static
|
||||
*/
|
||||
public function withType(string $type): static
|
||||
{
|
||||
return $this->state(fn () => ['type' => $type]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 변수 포함 본문
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function withVariables(): static
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'subject' => [
|
||||
'ko' => '[{app_name}] {name}님 환영합니다',
|
||||
'en' => '[{app_name}] Welcome {name}',
|
||||
],
|
||||
'body' => [
|
||||
'ko' => '<p>{name}님, {app_name}에 가입해 주셔서 감사합니다.</p>',
|
||||
'en' => '<p>Welcome {name}, thank you for joining {app_name}.</p>',
|
||||
],
|
||||
'variables' => [
|
||||
['key' => 'name', 'description' => '수신자 이름'],
|
||||
['key' => 'app_name', 'description' => '사이트명'],
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\NotificationDefinition;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* NotificationDefinition 팩토리
|
||||
*
|
||||
* @extends Factory<NotificationDefinition>
|
||||
*/
|
||||
class NotificationDefinitionFactory extends Factory
|
||||
{
|
||||
protected $model = NotificationDefinition::class;
|
||||
|
||||
/**
|
||||
* 기본 상태를 정의합니다.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'type' => $this->faker->unique()->slug(2),
|
||||
'hook_prefix' => 'core',
|
||||
'extension_type' => 'core',
|
||||
'extension_identifier' => '',
|
||||
'name' => ['ko' => $this->faker->words(2, true), 'en' => $this->faker->words(2, true)],
|
||||
'description' => ['ko' => $this->faker->sentence(), 'en' => $this->faker->sentence()],
|
||||
'variables' => [],
|
||||
'channels' => ['database'],
|
||||
'hooks' => [],
|
||||
'is_active' => true,
|
||||
'is_default' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user