CommentRepository
extends AbstractRepository
in package
implements
CommentRepositoryInterface
Uses
HasApprove, HasFilterTagUserTrait
Class CommentRepository.
Tags
Table of Contents
Interfaces
- CommentRepositoryInterface
- Interface Comment.
Constants
- NEWEST_SORT_OPERATOR = '>'
- OLDEST_SORT_OPERATOR = '<'
- REGEX_LINK = '/(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\-\\.@:%_\\+~#=]+)+((\\.[a-zA-Z])*)(\\/([0-9A-Za-z-\\-\\.@:%_\\+~#=\\?,])*)*/'
Properties
- $disableSponsor : mixed
- $skipPresenter : mixed
Methods
- approve() : bool
- buildQueryScopes() : mixed
- checkSpam() : bool
- cleanContent() : string|null
- cleanTitle() : string|null
- createComment() : Comment
- createMany() : bool
- deleteCommentById() : array<string, mixed>
- deleteCommentByParentId() : bool
- fallbackMentionUsers() : array<string|int, mixed>
- fallbackTagUsers() : array<string|int, mixed>
- filterMentionUsers() : array<string|int, mixed>
- filterTagUsers() : array<string|int, mixed>
- find() : Comment
- getModel() : Comment
- getRelatedCommentForItemDetailQuery() : Builder
- getRelatedComments() : Collection
- getRelatedCommentsByType() : Collection
- getRelatedCommentsByTypeQuery() : Builder
- getRelatedCommentsForItemDetail() : Collection
- getRelevantCommentsById() : Collection|null
- getTotalHidden() : int
- getUserContractMorphTypeColumns() : array<string|int, string>
- getUsersCommentByItem() : array<int, mixed>
- hasSponsorView() : bool
- isNoSponsorView() : bool
- isPending() : bool
- likeOperator() : string
- return the case-insensitive LIKE operator bases on the current database driver.
- model() : string
- removeLinkPreview() : bool
- removeMentionsFromContent() : string|null
- transformTaggedFriends() : array<string|int, mixed>
- updateComment() : Comment
- viewComment() : Comment
- viewComments() : Collection
- where() : $this
- withUserMorphTypeActiveScope() : self
- buildConditionForViewDetailCommentInMobile() : void
- buildOrderFriend() : string
- commentHistoryRepository() : CommentHistoryRepositoryInterface
- handleIsApproved() : bool
- handleMentionedUsers() : array<string|int, mixed>
- handleTaggedUsers() : array<string|int, mixed>
- mappingComment() : Collection
- buildCommentsQuery() : Builder
- handleCreateAttachment() : void
- handleDeleteAttachment() : void
- validateText() : void
Constants
NEWEST_SORT_OPERATOR
public
mixed
NEWEST_SORT_OPERATOR
= '>'
OLDEST_SORT_OPERATOR
public
mixed
OLDEST_SORT_OPERATOR
= '<'
REGEX_LINK
public
mixed
REGEX_LINK
= '/(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\-\\.@:%_\\+~#=]+)+((\\.[a-zA-Z])*)(\\/([0-9A-Za-z-\\-\\.@:%_\\+~#=\\?,])*)*/'
Properties
$disableSponsor
protected
mixed
$disableSponsor
$skipPresenter
protected
mixed
$skipPresenter
= true
Methods
approve()
public
approve(User $context, int $id) : bool
Parameters
- $context : User
- $id : int
Tags
Return values
boolbuildQueryScopes()
public
buildQueryScopes(mixed $query, mixed $model, mixed $criteria) : mixed
Parameters
- $query : mixed
- $model : mixed
- $criteria : mixed
checkSpam()
public
checkSpam(User $user, int $commentId, string $content, int $stickerId, bool $hasPhotoId) : bool
Parameters
- $user : User
- $commentId : int
- $content : string
- $stickerId : int
- $hasPhotoId : bool
Return values
boolcleanContent()
public
cleanContent(string|null $string) : string|null
Parameters
- $string : string|null
Return values
string|nullcleanTitle()
public
cleanTitle(string|null $string) : string|null
Parameters
- $string : string|null
Return values
string|nullcreateComment()
public
createComment(User $context, array<string|int, mixed> $attributes) : Comment
Parameters
- $context : User
- $attributes : array<string|int, mixed>
Return values
CommentcreateMany()
public
createMany(array<string|int, mixed> $items) : bool
Parameters
- $items : array<string|int, mixed>
Return values
booldeleteCommentById()
public
deleteCommentById(User $context, int $id) : array<string, mixed>
Parameters
- $context : User
- $id : int
Tags
Return values
array<string, mixed>deleteCommentByParentId()
public
deleteCommentByParentId(int $parentId) : bool
Parameters
- $parentId : int
Return values
boolfallbackMentionUsers()
public
fallbackMentionUsers(User $context, User $user, array<string|int, mixed> $mentionUserIds) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed>fallbackTagUsers()
public
fallbackTagUsers(User $context, User $user, array<string|int, mixed> $taggedUserIds) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed>filterMentionUsers()
public
filterMentionUsers(User $context, User $user, User $owner, array<string|int, mixed> $mentionUserIds) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed>filterTagUsers()
public
filterTagUsers(User $context, User $user, User $owner, array<string|int, mixed> $taggedUserIds) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed>find()
public
find(mixed $id, mixed $columns) : Comment
Parameters
- $id : mixed
- $columns : mixed
Return values
CommentgetModel()
public
getModel() : Comment
Return values
CommentgetRelatedCommentForItemDetailQuery()
public
getRelatedCommentForItemDetailQuery(User $context, mixed $itemType, mixed $itemId[, array<string|int, mixed> $attributes = [] ]) : Builder
Parameters
- $context : User
- $itemType : mixed
- $itemId : mixed
- $attributes : array<string|int, mixed> = []
Return values
BuildergetRelatedComments()
public
getRelatedComments(User $context, HasTotalComment $content) : Collection
Parameters
- $context : User
- $content : HasTotalComment
Return values
CollectiongetRelatedCommentsByType()
public
getRelatedCommentsByType(User $context, string $itemType, int $itemId[, array<string|int, mixed> $attributes = [] ]) : Collection
Parameters
- $context : User
- $itemType : string
- $itemId : int
- $attributes : array<string|int, mixed> = []
Return values
CollectiongetRelatedCommentsByTypeQuery()
public
getRelatedCommentsByTypeQuery(User $context, string $itemType, int $itemId[, array<string|int, mixed> $attributes = [] ]) : Builder
Parameters
- $context : User
- $itemType : string
- $itemId : int
- $attributes : array<string|int, mixed> = []
Return values
BuildergetRelatedCommentsForItemDetail()
public
getRelatedCommentsForItemDetail(User $context, HasTotalComment $content[, int $limit = 6 ][, array<string|int, mixed> $attributes = [] ]) : Collection
Parameters
- $context : User
- $content : HasTotalComment
- $limit : int = 6
- $attributes : array<string|int, mixed> = []
Return values
CollectiongetRelevantCommentsById()
public
getRelevantCommentsById(User $context, int $id[, Entity|null $content = null ][, bool $isFeed = true ]) : Collection|null
Parameters
Return values
Collection|nullgetTotalHidden()
public
getTotalHidden(User $context, HasTotalComment $item[, int $parentId = 0 ]) : int
Parameters
- $context : User
- $item : HasTotalComment
- $parentId : int = 0
Return values
intgetUserContractMorphTypeColumns()
public
getUserContractMorphTypeColumns() : array<string|int, string>
Return values
array<string|int, string>getUsersCommentByItem()
public
getUsersCommentByItem(User $context, array<string|int, mixed> $attributes) : array<int, mixed>
Parameters
- $context : User
- $attributes : array<string|int, mixed>
Tags
Return values
array<int, mixed>hasSponsorView()
public
hasSponsorView(array<string|int, mixed> $attributes) : bool
Parameters
- $attributes : array<string|int, mixed>
Return values
boolisNoSponsorView()
public
isNoSponsorView(string|null $view) : bool
Parameters
- $view : string|null
Return values
boolisPending()
public
isPending(Content $model) : bool
Parameters
- $model : Content
Return values
boollikeOperator()
return the case-insensitive LIKE operator bases on the current database driver.
public
likeOperator() : string
Return values
stringmodel()
public
model() : string
Return values
stringremoveLinkPreview()
public
removeLinkPreview(Comment $comment) : bool
Parameters
- $comment : Comment
Return values
boolremoveMentionsFromContent()
public
removeMentionsFromContent(string|null $content, array<string|int, mixed> $removedIds) : string|null
Parameters
- $content : string|null
- $removedIds : array<string|int, mixed>
Return values
string|nulltransformTaggedFriends()
public
transformTaggedFriends(User $context, User $user, User|null $owner, array<string|int, mixed> $taggedFriends[, string|null $content = null ][, HasTaggedFriend|null $item = null ][, bool $removeMentionOnContent = true ]) : array<string|int, mixed>
Parameters
- $context : User
- $user : User
- $owner : User|null
- $taggedFriends : array<string|int, mixed>
- $content : string|null = null
- $item : HasTaggedFriend|null = null
- $removeMentionOnContent : bool = true
Return values
array<string|int, mixed>updateComment()
public
updateComment(User $context, int $id, array<string|int, mixed> $attributes) : Comment
Parameters
- $context : User
- $id : int
- $attributes : array<string|int, mixed>
Return values
CommentviewComment()
public
viewComment(User $context, int $id) : Comment
Parameters
- $context : User
- $id : int
Return values
CommentviewComments()
public
viewComments(User $context, array<string|int, mixed> $attributes) : Collection
Parameters
- $context : User
- $attributes : array<string|int, mixed>
Return values
Collectionwhere()
public
where(array<string|int, mixed> $params) : $this
Parameters
- $params : array<string|int, mixed>
Tags
Return values
$thiswithUserMorphTypeActiveScope()
public
withUserMorphTypeActiveScope() : self
Return values
selfbuildConditionForViewDetailCommentInMobile()
protected
buildConditionForViewDetailCommentInMobile(Builder $query, int|null $commentId) : void
Parameters
- $query : Builder
- $commentId : int|null
buildOrderFriend()
protected
buildOrderFriend(User $context) : string
Parameters
- $context : User
Return values
stringcommentHistoryRepository()
protected
commentHistoryRepository() : CommentHistoryRepositoryInterface
Return values
CommentHistoryRepositoryInterfacehandleIsApproved()
protected
handleIsApproved(User $context, Content|null $item) : bool
Parameters
Return values
boolhandleMentionedUsers()
protected
handleMentionedUsers(User $context, User $user, User $owner, array<string|int, mixed> $mentionedUsers, string|null &$content[, bool $removeMentionOnContent = true ]) : array<string|int, mixed>
Parameters
- $context : User
- $user : User
- $owner : User
- $mentionedUsers : array<string|int, mixed>
- $content : string|null
- $removeMentionOnContent : bool = true
Return values
array<string|int, mixed>handleTaggedUsers()
protected
handleTaggedUsers(User $context, User $user, User $owner, array<string|int, mixed> $taggedUsers) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed>mappingComment()
protected
mappingComment(User $context, Collection $comments, mixed $limitChildren) : Collection
Parameters
- $context : User
- $comments : Collection
- $limitChildren : mixed
Return values
CollectionbuildCommentsQuery()
private
buildCommentsQuery(User $context, array<string, mixed> $attributes) : Builder
Parameters
- $context : User
- $attributes : array<string, mixed>
Return values
BuilderhandleCreateAttachment()
private
handleCreateAttachment(Comment $comment, string $itemType[, int $itemId = 0 ][, string $oldText = '' ]) : void
Parameters
- $comment : Comment
- $itemType : string
- $itemId : int = 0
- $oldText : string = ''
handleDeleteAttachment()
private
handleDeleteAttachment(Comment $comment, string $itemType) : void
Parameters
- $comment : Comment
- $itemType : string
validateText()
private
validateText(Comment $comment, array<string, mixed> $attributes) : void
Parameters
- $comment : Comment
- $attributes : array<string, mixed>