FeedRepository
        
        extends AbstractRepository
    
    
            
            in package
            
        
    
            
            implements
                            FeedRepositoryInterface                    
    
            
            Uses
                            IsFriendTrait,                             HasSponsor                    
    
Class FeedRepository.
Tags
Table of Contents
Interfaces
- FeedRepositoryInterface
 - Interface FeedRepositoryInterface.
 
Properties
- $model : Feed
 - $disableSponsor : mixed
 - $historyRepository : ActivityHistoryRepositoryInterface
 - $skipPresenter : mixed
 
Methods
- __construct() : mixed
 - allowReviewTag() : bool
 - approvePendingFeed() : array<int, mixed>
 - approvePendingFeeds() : void
 - archiveFeed() : bool
 - buildQueryScopes() : mixed
 - canAddFriend() : bool
 - checkSpamStatus() : bool
 - cleanContent() : string|null
 - cleanTitle() : string|null
 - countFeed() : int
 - countFeedPendingOnOwner() : int
 - countPinnedFeeds() : int
 - countTotalFriend() : int
 - countTotalFriendRequest() : int
 - countTotalMutualFriend() : int
 - createFeed() : array<string, mixed>
 - Create a feed (activity post).
 - createMany() : bool
 - declinePendingFeed() : bool
 - deleteFeed() : bool
 - Delete a feed.
 - deleteFeedByUserAndOwner() : void
 - disableSponsor() : void
 - enableSponsor() : void
 - find() : Feed
 - getFeed() : Feed
 - Get feed detail.
 - getFeedByItem() : Feed
 - getFeedByItemId() : Feed|null
 - getFeedForEdit() : Feed
 - getFeeds() : array<string|int, Feed>|Collection
 - Get main activity feeds.
 - getMissingContentFeed() : Collection
 - getModel() : Feed
 - getOwnerPrivacyDetail() : array<string|int, mixed>
 - getPinnedFeedIds() : array<string|int, mixed>
 - getPinnedFeeds() : Collection
 - getPrivacyDetail() : array<string|int, mixed>
 - getPrivacyIds() : array<string|int, mixed>
 - getRandomSponsoredItems() : Collection
 - getSpamStatusSetting() : int
 - getSponsoredItem() : Content|null
 - getSponsorPriceForPayment() : float|null
 - getTaggedFriend() : mixed
 - getTaggedFriendItems() : array<string|int, mixed>
 - getTaggedFriends() : LengthAwarePaginator
 - getUserContractMorphTypeColumns() : array<string|int, string>
 - handlePutToTagStream() : mixed
 - handleRemoveNotification() : void
 - hasNewFeeds() : bool
 - hasSponsorView() : bool
 - hideFeed() : bool
 - Hide a feed.
 - isFriend() : bool
 - isNoSponsorView() : bool
 - isSponsor() : bool
 - likeOperator() : string
 - return the case-insensitive LIKE operator bases on the current database driver.
 - model() : string
 - pinFeed() : bool
 - pushFeedOnTop() : bool
 - removeTagFriend() : bool
 - sponsor() : bool
 - sponsorFeed() : bool
 - unHideFeed() : bool
 - UnHide a feed.
 - unPinFeed() : bool
 - unsponsor() : bool
 - updateFeed() : Feed
 - Update a feed.
 - updateFeedPrivacy() : Feed
 - Update feed privacy.
 - where() : $this
 - withUserMorphTypeActiveScope() : self
 - collectIcons() : array<string|int, mixed>
 - getDefaultPrivacyDetail() : array<string|int, mixed>
 - getSponsorPriceValue() : array<string|int, mixed>
 - handleCreateHistory() : ActivityHistory|null
 - handlePrivacyDetail() : array<string|int, mixed>
 - hasNewPinnedFeeds() : bool
 - filterPinnedFeedPrivacy() : Collection
 - getStreamManager() : StreamManagerInterface
 - shareRepository() : ShareRepositoryInterface
 
Properties
$model
    public
        Feed
    $model
    
    
    
    
$disableSponsor
    protected
        mixed
    $disableSponsor
    
    
    
    
$historyRepository
    protected
        ActivityHistoryRepositoryInterface
    $historyRepository
    
    
    
    
$skipPresenter
    protected
        mixed
    $skipPresenter
     = true
    
    
    
Methods
__construct()
    public
                    __construct(Container $app, ActivityHistoryRepositoryInterface $historyRepository) : mixed
    Parameters
- $app : Container
 - $historyRepository : ActivityHistoryRepositoryInterface
 
allowReviewTag()
    public
                    allowReviewTag(User $context, Feed $feed, array<string|int, mixed> $params) : bool
    Parameters
Return values
boolapprovePendingFeed()
    public
                    approvePendingFeed(User $context, int $id) : array<int, mixed>
    Parameters
- $context : User
 - $id : int
 
Tags
Return values
array<int, mixed> —the returned array should be as format array($data, $extra, $message)
approvePendingFeeds()
    public
                    approvePendingFeeds(User $user, User $owner) : void
    Parameters
Tags
archiveFeed()
    public
                    archiveFeed(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
 
canAddFriend()
    public
                    canAddFriend(User $context[, User|null $user = null ]) : bool
    Parameters
Return values
boolcheckSpamStatus()
    public
                    checkSpamStatus(User $user, string $itemType, string|null $content[, int|null $itemId = null ]) : bool
    Parameters
- $user : User
 - $itemType : string
 - $content : string|null
 - $itemId : int|null = null
 
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|nullcountFeed()
    public
                    countFeed(string $ownerType, int $ownerId[, string|null $status = MetaFoxConstant::ITEM_STATUS_APPROVED ][, int|null $userId = null ]) : int
    Parameters
- $ownerType : string
 - $ownerId : int
 - $status : string|null = MetaFoxConstant::ITEM_STATUS_APPROVED
 - $userId : int|null = null
 
Return values
intcountFeedPendingOnOwner()
    public
                    countFeedPendingOnOwner(User $context, User $owner) : int
    Parameters
Return values
intcountPinnedFeeds()
    public
                    countPinnedFeeds(User $context) : int
    Parameters
- $context : User
 
Return values
intcountTotalFriend()
    public
                    countTotalFriend(int $userId) : int
    Parameters
- $userId : int
 
Return values
intcountTotalFriendRequest()
    public
                    countTotalFriendRequest(User $user) : int
    Parameters
- $user : User
 
Return values
intcountTotalMutualFriend()
    public
                    countTotalMutualFriend(int $contextId, int $userId) : int
    Parameters
- $contextId : int
 - $userId : int
 
Return values
intcreateFeed()
Create a feed (activity post).
    public
                    createFeed(User $context, User $user, User $owner, array<string|int, mixed> $params) : array<string, mixed>
    Parameters
Tags
Return values
array<string, mixed>createMany()
    public
                    createMany(array<string|int, mixed> $items) : bool
    Parameters
- $items : array<string|int, mixed>
 
Return values
booldeclinePendingFeed()
    public
                    declinePendingFeed(User $context, int $id, array<string|int, mixed> $params) : bool
    Parameters
- $context : User
 - $id : int
 - $params : array<string|int, mixed>
 
Return values
booldeleteFeed()
Delete a feed.
    public
                    deleteFeed(User $user, int $id) : bool
    Parameters
- $user : User
 - $id : int
 
Return values
booldeleteFeedByUserAndOwner()
    public
                    deleteFeedByUserAndOwner(User $context, Content $owner) : void
    Parameters
Tags
disableSponsor()
    public
                    disableSponsor(Content $content) : void
    Parameters
- $content : Content
 
enableSponsor()
    public
                    enableSponsor(Content $content) : void
    Parameters
- $content : Content
 
find()
    public
                    find(mixed $id, mixed $columns) : Feed
    Parameters
- $id : mixed
 - $columns : mixed
 
Return values
FeedgetFeed()
Get feed detail.
    public
                    getFeed(User|null $user, int $id) : Feed
    Parameters
- $user : User|null
 - $id : int
 
Return values
FeedgetFeedByItem()
    public
                    getFeedByItem(User|null $context, Entity|null $content[, string|null $typeId = null ]) : Feed
    Parameters
Return values
FeedgetFeedByItemId()
    public
                    getFeedByItemId(User $context, int $itemId, string $itemType, string $typeId[, bool $checkPermission = true ]) : Feed|null
    Parameters
- $context : User
 - $itemId : int
 - $itemType : string
 - $typeId : string
 - $checkPermission : bool = true
 
Return values
Feed|nullgetFeedForEdit()
    public
                    getFeedForEdit(User $context, int $id) : Feed
    Parameters
- $context : User
 - $id : int
 
Return values
FeedgetFeeds()
Get main activity feeds.
    public
                    getFeeds(User $user[, User|null $owner = null ][, int|null $lastFeedId = null ][, int $need = Pagination::DEFAULT_ITEM_PER_PAGE ][, string|null $hashtag = null ][, bool $friendOnly = false ][, array<string|int, mixed>|null $extraConditions = null ][, string|null $sort = Browse::SORT_RECENT ][, string|null $sortType = MetaFoxConstant::SORT_DESC ][, bool $getFeedSponsor = false ][, array<string|int, mixed>|null $status = null ][, bool $isPreviewTag = false ][, array<string|int, mixed>|null $loadedSponsoredFeedIds = null ][, array<string|int, mixed> $params = [] ]) : array<string|int, Feed>|Collection
    Parameters
- $user : User
 - $owner : User|null = null
 - $lastFeedId : int|null = null
 - $need : int = Pagination::DEFAULT_ITEM_PER_PAGE
 - $hashtag : string|null = null
 - $friendOnly : bool = false
 - $extraConditions : array<string|int, mixed>|null = null
 - $sort : string|null = Browse::SORT_RECENT
 - $sortType : string|null = MetaFoxConstant::SORT_DESC
 - $getFeedSponsor : bool = false
 - $status : array<string|int, mixed>|null = null
 - $isPreviewTag : bool = false
 - $loadedSponsoredFeedIds : array<string|int, mixed>|null = null
 - $params : array<string|int, mixed> = []
 
Tags
Return values
array<string|int, Feed>|CollectiongetMissingContentFeed()
    public
                    getMissingContentFeed(string $typeId) : Collection
    Parameters
- $typeId : string
 
Return values
CollectiongetModel()
    public
                    getModel() : Feed
    Return values
FeedgetOwnerPrivacyDetail()
    public
                    getOwnerPrivacyDetail(User $context, User $resource[, int|null $representativePrivacy = null ]) : array<string|int, mixed>
    Parameters
Return values
array<string|int, mixed>getPinnedFeedIds()
    public
                    getPinnedFeedIds(User $context) : array<string|int, mixed>
    Parameters
- $context : User
 
Return values
array<string|int, mixed>getPinnedFeeds()
    public
                    getPinnedFeeds(User $user, User $owner) : Collection
    Parameters
Return values
CollectiongetPrivacyDetail()
    public
                    getPrivacyDetail(User $context, Content $resource[, int|null $representativePrivacy = null ]) : array<string|int, mixed>
    Parameters
Return values
array<string|int, mixed>getPrivacyIds()
    public
                    getPrivacyIds(User $owner, Feed $feed) : array<string|int, mixed>
    Parameters
Return values
array<string|int, mixed>getRandomSponsoredItems()
    public
                    getRandomSponsoredItems(User $context, int $limit[, array<string|int, mixed>|null $loadedItemIds = null ]) : Collection
    Parameters
- $context : User
 - $limit : int
 - $loadedItemIds : array<string|int, mixed>|null = null
 
Return values
CollectiongetSpamStatusSetting()
    public
                    getSpamStatusSetting() : int
    Return values
intgetSponsoredItem()
    public
                    getSponsoredItem(array<string|int, mixed> $notInIds[, int|null $sponsorStart = null ][, array<string|int, mixed> $with = [] ]) : Content|null
    Parameters
- $notInIds : array<string|int, mixed>
 - $sponsorStart : int|null = null
 - $with : array<string|int, mixed> = []
 
Return values
Content|nullgetSponsorPriceForPayment()
    public
                    getSponsorPriceForPayment(User $user[, string|null $currencyId = null ]) : float|null
    Parameters
- $user : User
 - $currencyId : string|null = null
 
Return values
float|nullgetTaggedFriend()
    public
                    getTaggedFriend(Entity|null $item, User $friend) : mixed
    Parameters
getTaggedFriendItems()
    public
                    getTaggedFriendItems(HasTaggedFriend $item[, int $limit = 10 ]) : array<string|int, mixed>
    Parameters
- $item : HasTaggedFriend
 - $limit : int = 10
 
Tags
Return values
array<string|int, mixed>getTaggedFriends()
    public
                    getTaggedFriends(int $itemId, string $itemType, int $limit[, array<string|int, mixed> $excludedIds = [] ]) : LengthAwarePaginator
    Parameters
- $itemId : int
 - $itemType : string
 - $limit : int
 - $excludedIds : array<string|int, mixed> = []
 
Return values
LengthAwarePaginatorgetUserContractMorphTypeColumns()
    public
                    getUserContractMorphTypeColumns() : array<string|int, string>
    Return values
array<string|int, string>handlePutToTagStream()
    public
                    handlePutToTagStream(User $context, User $friend, int $itemId, string $itemType, string $typeId) : mixed
    Parameters
Tags
handleRemoveNotification()
    public
                    handleRemoveNotification(string $notificationType, int $itemId, string $itemType) : void
    Parameters
- $notificationType : string
 - $itemId : int
 - $itemType : string
 
hasNewFeeds()
    public
                    hasNewFeeds(User $context[, int $lastFeedId = 0 ][, int $lastPinFeedId = 0 ][, User|null $owner = null ][, string|null $sort = null ][, int $lastSponsoredFeedId = 0 ]) : bool
    Parameters
- $context : User
 - $lastFeedId : int = 0
 - $lastPinFeedId : int = 0
 - $owner : User|null = null
 - $sort : string|null = null
 - $lastSponsoredFeedId : int = 0
 
Tags
Return values
boolhasSponsorView()
    public
                    hasSponsorView(array<string|int, mixed> $attributes) : bool
    Parameters
- $attributes : array<string|int, mixed>
 
Return values
boolhideFeed()
Hide a feed.
    public
                    hideFeed(User $user, Feed $feed) : bool
    Parameters
Return values
boolisFriend()
    public
                    isFriend(User $context[, User|null $user = null ]) : bool
    Parameters
Return values
boolisNoSponsorView()
    public
                    isNoSponsorView(string|null $view) : bool
    Parameters
- $view : string|null
 
Return values
boolisSponsor()
    public
                    isSponsor(Content $model) : bool
    Parameters
- $model : Content
 
Tags
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
stringpinFeed()
    public
                    pinFeed(User $context, User|null $owner, int $feedId) : bool
    Parameters
Return values
boolpushFeedOnTop()
    public
                    pushFeedOnTop(int $feedId) : bool
    Parameters
- $feedId : int
 
Tags
Return values
boolremoveTagFriend()
    public
                    removeTagFriend(Feed $feed) : bool
    Parameters
- $feed : Feed
 
Tags
Return values
boolsponsor()
    public
                    sponsor(User $context, int $id, int $sponsor) : bool
    Parameters
- $context : User
 - $id : int
 - $sponsor : int
 
Tags
Return values
boolsponsorFeed()
    public
                    sponsorFeed(User $context, Feed $feed, int $sponsor) : bool
    Parameters
Tags
Return values
boolunHideFeed()
UnHide a feed.
    public
                    unHideFeed(User $user, Feed $feed) : bool
    Parameters
Return values
boolunPinFeed()
    public
                    unPinFeed(User $context, User|null $owner, int $id) : bool
    Parameters
Return values
boolunsponsor()
    public
                    unsponsor(User $context, int $id) : bool
    Parameters
- $context : User
 - $id : int
 
Return values
boolupdateFeed()
Update a feed.
    public
                    updateFeed(User $context, User $user, int $id, array<string, mixed> $params) : Feed
    Parameters
Tags
Return values
FeedupdateFeedPrivacy()
Update feed privacy.
    public
                    updateFeedPrivacy(User $context, Feed $feed, array<string, mixed> $params) : Feed
    Parameters
Tags
Return values
Feedwhere()
    public
                    where(array<string|int, mixed> $params) : $this
    Parameters
- $params : array<string|int, mixed>
 
Tags
Return values
$thiswithUserMorphTypeActiveScope()
    public
                    withUserMorphTypeActiveScope() : self
    Return values
selfcollectIcons()
    protected
                    collectIcons() : array<string|int, mixed>
    Return values
array<string|int, mixed>getDefaultPrivacyDetail()
    protected
                    getDefaultPrivacyDetail(int $privacy[, User|null $context = null ][, User|null $owner = null ]) : array<string|int, mixed>
    Parameters
Return values
array<string|int, mixed>getSponsorPriceValue()
    protected
                    getSponsorPriceValue([int|null $roleId = null ]) : array<string|int, mixed>
    Parameters
- $roleId : int|null = null
 
Return values
array<string|int, mixed>handleCreateHistory()
    protected
                    handleCreateHistory(User $user, Feed $feed, bool $hasUpdateContent, string $postType[, bool $isPhrase = false ]) : ActivityHistory|null
    Parameters
Return values
ActivityHistory|nullhandlePrivacyDetail()
    protected
                    handlePrivacyDetail(User $context, Content $resource, User|null $owner[, int|null $representativePrivacy = null ]) : array<string|int, mixed>
    Parameters
Return values
array<string|int, mixed>hasNewPinnedFeeds()
    protected
                    hasNewPinnedFeeds(User $context, int $lastPinFeedId[, User|null $owner = null ]) : bool
    Parameters
Return values
boolfilterPinnedFeedPrivacy()
    private
                    filterPinnedFeedPrivacy(User $user, Collection $feeds, array<string|int, mixed> $pinnedFeedIds) : Collection
    Parameters
- $user : User
 - $feeds : Collection
 - $pinnedFeedIds : array<string|int, mixed>
 
Return values
CollectiongetStreamManager()
    private
                    getStreamManager() : StreamManagerInterface
    Return values
StreamManagerInterfaceshareRepository()
    private
                    shareRepository() : ShareRepositoryInterface