v7.0.0 release
This commit is contained in:
@@ -7,12 +7,31 @@ use App\Enums\NotificationLogStatus;
|
||||
use App\Models\NotificationLog;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
|
||||
class NotificationLogRepository implements NotificationLogRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* 최근 발송된 알림 로그를 발송 시각 최신순으로 조회합니다 (대시보드 최근 알림).
|
||||
*
|
||||
* @param int $limit 조회 건수
|
||||
* @return Collection<int, NotificationLog> 최근 알림 로그 컬렉션
|
||||
*/
|
||||
public function getRecent(int $limit): Collection
|
||||
{
|
||||
return NotificationLog::with(['recipientUser'])
|
||||
->orderByDesc('sent_at')
|
||||
->orderByDesc('id')
|
||||
->limit($limit)
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* ID로 알림 로그 조회.
|
||||
*
|
||||
* @param int $id 알림 로그 ID
|
||||
* @return NotificationLog|null 알림 로그 또는 null
|
||||
*/
|
||||
public function findById(int $id): ?NotificationLog
|
||||
{
|
||||
@@ -21,6 +40,9 @@ class NotificationLogRepository implements NotificationLogRepositoryInterface
|
||||
|
||||
/**
|
||||
* 알림 로그 생성.
|
||||
*
|
||||
* @param array<string, mixed> $data 생성 데이터
|
||||
* @return NotificationLog 생성된 알림 로그
|
||||
*/
|
||||
public function create(array $data): NotificationLog
|
||||
{
|
||||
@@ -29,6 +51,9 @@ class NotificationLogRepository implements NotificationLogRepositoryInterface
|
||||
|
||||
/**
|
||||
* 알림 로그 삭제.
|
||||
*
|
||||
* @param NotificationLog $log 삭제 대상 알림 로그
|
||||
* @return bool 삭제 성공 여부
|
||||
*/
|
||||
public function delete(NotificationLog $log): bool
|
||||
{
|
||||
@@ -37,6 +62,9 @@ class NotificationLogRepository implements NotificationLogRepositoryInterface
|
||||
|
||||
/**
|
||||
* 다건 삭제.
|
||||
*
|
||||
* @param array<int, int> $ids 삭제할 알림 로그 ID 목록
|
||||
* @return int 삭제된 건수
|
||||
*/
|
||||
public function bulkDelete(array $ids): int
|
||||
{
|
||||
@@ -45,6 +73,11 @@ class NotificationLogRepository implements NotificationLogRepositoryInterface
|
||||
|
||||
/**
|
||||
* 페이지네이션 목록 조회.
|
||||
*
|
||||
* @param array<string, mixed> $filters 필터 조건
|
||||
* @param int $perPage 페이지당 건수
|
||||
* @param User|null $scopeUser 스코프 적용 대상 사용자 (null이면 스코프 미적용)
|
||||
* @return LengthAwarePaginator 페이지네이션 결과
|
||||
*/
|
||||
public function getPaginated(array $filters = [], int $perPage = 20, ?User $scopeUser = null): LengthAwarePaginator
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user