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
@@ -125,8 +125,6 @@ class Board extends Model
|
||||
// 알림 설정
|
||||
'notify_author',
|
||||
'notify_admin_on_post',
|
||||
'notify_author_channels',
|
||||
'notify_admin_on_post_channels',
|
||||
|
||||
// 기타 설정
|
||||
'blocked_keywords',
|
||||
@@ -156,8 +154,6 @@ class Board extends Model
|
||||
'use_file_upload' => 'boolean',
|
||||
'notify_author' => 'boolean',
|
||||
'notify_admin_on_post' => 'boolean',
|
||||
'notify_author_channels' => 'array',
|
||||
'notify_admin_on_post_channels' => 'array',
|
||||
'secret_mode' => SecretMode::class,
|
||||
'order_by' => BoardOrderBy::class,
|
||||
'order_direction' => OrderDirection::class,
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Sirsoft\Board\Models;
|
||||
|
||||
use App\Models\Concerns\MailTemplateBehavior;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* 게시판 메일 템플릿 모델
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $type
|
||||
* @property array $subject
|
||||
* @property array $body
|
||||
* @property array $variables
|
||||
* @property bool $is_active
|
||||
* @property bool $is_default
|
||||
* @property int|null $updated_by
|
||||
*/
|
||||
class BoardMailTemplate extends Model
|
||||
{
|
||||
use MailTemplateBehavior;
|
||||
|
||||
/**
|
||||
* @var string 테이블명
|
||||
*/
|
||||
protected $table = 'board_mail_templates';
|
||||
|
||||
/**
|
||||
* @var array<string, mixed> 기본 속성 값
|
||||
*/
|
||||
protected $attributes = [
|
||||
'variables' => '[]',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array<int, string> 대량 할당 가능 필드
|
||||
*/
|
||||
protected $fillable = [
|
||||
'type',
|
||||
'subject',
|
||||
'body',
|
||||
'variables',
|
||||
'is_active',
|
||||
'is_default',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
/**
|
||||
* 마지막 수정자 관계를 반환합니다.
|
||||
*
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function updater(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'updated_by');
|
||||
}
|
||||
}
|
||||
@@ -2,35 +2,50 @@
|
||||
|
||||
namespace Modules\Sirsoft\Board\Models;
|
||||
|
||||
use App\Models\Concerns\HasUserOverrides;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* 게시판 유형 모델
|
||||
* 게시판 유형 모델.
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $slug
|
||||
* @property array $name
|
||||
* @property array|null $user_overrides
|
||||
* @property \Illuminate\Support\Carbon $created_at
|
||||
* @property \Illuminate\Support\Carbon $updated_at
|
||||
*
|
||||
* @since 7.0.0-beta.2 (HasUserOverrides 적용)
|
||||
*/
|
||||
class BoardType extends Model
|
||||
{
|
||||
use HasUserOverrides;
|
||||
|
||||
/** @var array<string, array> 활동 로그 추적 필드 */
|
||||
public static array $activityLogFields = [
|
||||
'slug' => ['label_key' => 'sirsoft-board::activity_log.fields.slug', 'type' => 'text'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 사용자 수정 보존 대상 필드.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected array $trackableFields = ['name'];
|
||||
|
||||
protected $table = 'board_types';
|
||||
|
||||
protected $fillable = [
|
||||
'slug',
|
||||
'name',
|
||||
'user_overrides',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'array',
|
||||
'user_overrides' => 'array',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -144,8 +144,7 @@ class Post extends Model implements FulltextSearchable
|
||||
public function comments(): HasMany
|
||||
{
|
||||
return $this->hasMany(Comment::class, 'post_id')
|
||||
->with(['user', 'parent'])
|
||||
->withCount('replies');
|
||||
->with(['user', 'parent']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,6 +159,20 @@ class Post extends Model implements FulltextSearchable
|
||||
->orderBy('order');
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록 썸네일용 첫 번째 이미지 첨부파일과의 관계를 정의합니다.
|
||||
*
|
||||
* 전체 attachments를 eager loading하는 대신 이미지 1건만 가져와 성능을 확보합니다.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function thumbnailAttachment(): \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
{
|
||||
return $this->hasOne(Attachment::class, 'post_id')
|
||||
->where('mime_type', 'like', 'image/%')
|
||||
->orderBy('order');
|
||||
}
|
||||
|
||||
/**
|
||||
* 신규 게시글 여부를 확인합니다.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user