PhotoRepository
extends AbstractRepository
in package
implements
PhotoRepositoryInterface
Uses
HasFeatured, HasSponsor, HasApprove, HasSponsorInFeed, CollectTotalItemStatTrait, HasFilterTagUserTrait
Class PhotoRepository.
Tags
Table of Contents
Interfaces
- PhotoRepositoryInterface
- Interface PhotoRepositoryInterface.
Properties
- $model : Photo
- $disableSponsor : mixed
- $skipPresenter : mixed
Methods
- approve() : bool
- buildQueryScopes() : mixed
- cleanContent() : string|null
- cleanTitle() : string|null
- cleanUpRelationData() : void
- createMany() : bool
- createPhoto() : array<string|int, int>
- deletePhoto() : array<string, mixed>
- deleteTaggedFriend() : false|int
- disableSponsor() : void
- downloadPhoto() : Photo
- enableSponsor() : void
- fallbackMentionUsers() : array<string|int, mixed>
- fallbackTagUsers() : array<string|int, mixed>
- feature() : bool
- filterMentionUsers() : array<string|int, mixed>
- filterTagUsers() : array<string|int, mixed>
- find() : Photo
- findFeature() : Paginator
- findSponsor() : Paginator
- getAlbum() : Album
- getModel() : Photo
- getPhotoByFeedId() : Paginator
- getPhotosByGroupId() : Collection|null
- getPrivacyFromAlbum() : array<string, mixed>
- getRandomSponsoredItems() : Collection
- getSponsoredItem() : Content|null
- getTaggedFriends() : Collection
- getTotalItemByPeriod() : int
- getTotalPendingItemByPeriod() : int
- getUserContractMorphTypeColumns() : array<string|int, string>
- hasSponsorView() : bool
- isFeature() : bool
- isFeedSponsored() : bool
- isNoSponsorView() : bool
- isPending() : bool
- isSponsor() : bool
- likeOperator() : string
- return the case-insensitive LIKE operator bases on the current database driver.
- makeParentAvatar() : array<string, mixed>|null
- makeParentCover() : bool
- makeProfileAvatar() : array<string, mixed>|null
- makeProfileCover() : bool
- model() : string
- newModelInstance() : Photo
- removeMentionsFromContent() : string|null
- sponsor() : bool
- sponsorInFeed() : bool
- tagFriend() : TagFriendModel
- tempFileToExistPhoto() : Photo
- tempFileToPhoto() : Photo
- transformTaggedFriends() : array<string|int, mixed>
- unsponsor() : bool
- unsponsorInFeed() : bool
- updateAvatarPath() : string
- updatePhoto() : Photo
- uploadMedias() : PhotoGroup
- viewPhoto() : Photo
- viewPhotos() : Paginator
- viewPhotoSet() : PhotoGroup
- where() : $this
- withUserMorphTypeActiveScope() : self
- getPrivacyForDefaultAlbum() : array<string|int, mixed>
- getPrivacyForNormalAlbum() : array<string|int, mixed>
- getPrivacyForRemovingAlbum() : array<string|int, mixed>
- handleBase64() : void
- handleMentionedUsers() : array<string|int, mixed>
- handleMultipleTagFriends() : void
- handleTaggedFriends() : bool
- handleTaggedUsers() : array<string|int, mixed>
- prepareDataForGroupUpdate() : void
- setContent() : void
- unsetContent() : mixed
- updateGlobalSearch() : bool|null
- uploadProfileCover() : UploadedFile|null
- uploadRawFile() : StorageFile
- applyDisplayPhotoSetting() : Builder
- buildQueryPhotos() : Builder
- categoryRepository() : CategoryRepositoryInterface
- checkPhotoQuota() : void
- checkUserUploadAvatarOrCover() : bool
- getAlbumRepository() : AlbumRepositoryInterface
- photoGroupRepository() : PhotoGroupRepositoryInterface
- userRepository() : UserRepositoryInterface
Properties
$model
public
Photo
$model
$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
cleanContent()
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|nullcleanUpRelationData()
public
cleanUpRelationData(Photo $photo) : void
Parameters
- $photo : Photo
Tags
createMany()
public
createMany(array<string|int, mixed> $items) : bool
Parameters
- $items : array<string|int, mixed>
Return values
boolcreatePhoto()
public
createPhoto(User $context, User $owner, array<string|int, mixed> $attributes[, int $albumType = Album::TIMELINE_ALBUM ][, string|null $typeId = null ]) : array<string|int, int>
Parameters
- $context : User
- $owner : User
- $attributes : array<string|int, mixed>
- $albumType : int = Album::TIMELINE_ALBUM
- $typeId : string|null = null
Tags
Return values
array<string|int, int>deletePhoto()
public
deletePhoto(User $context, int $id) : array<string, mixed>
Parameters
- $context : User
- $id : int
Tags
Return values
array<string, mixed>deleteTaggedFriend()
public
deleteTaggedFriend(User $user, int $tagId) : false|int
Parameters
- $user : User
- $tagId : int
Tags
Return values
false|intdisableSponsor()
public
disableSponsor(Content $content) : void
Parameters
- $content : Content
downloadPhoto()
public
downloadPhoto(User $context, int $id) : Photo
Parameters
- $context : User
- $id : int
Return values
PhotoenableSponsor()
public
enableSponsor(Content $content) : void
Parameters
- $content : Content
fallbackMentionUsers()
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>feature()
public
feature(User $context, int $id, int $feature) : bool
Parameters
- $context : User
- $id : int
- $feature : int
Tags
Return values
boolfilterMentionUsers()
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) : Photo
Parameters
- $id : mixed
- $columns : mixed
Return values
PhotofindFeature()
public
findFeature([int $limit = 4 ]) : Paginator
Parameters
- $limit : int = 4
Return values
PaginatorfindSponsor()
public
findSponsor([int $limit = 4 ]) : Paginator
Parameters
- $limit : int = 4
Return values
PaginatorgetAlbum()
public
getAlbum(User $user, User $owner, int $albumType) : Album
Parameters
Return values
AlbumgetModel()
public
getModel() : Photo
Return values
PhotogetPhotoByFeedId()
public
getPhotoByFeedId(User $context, int $feedId[, array<string|int, mixed> $attributes = [] ]) : Paginator
Parameters
- $context : User
- $feedId : int
- $attributes : array<string|int, mixed> = []
Return values
PaginatorgetPhotosByGroupId()
public
getPhotosByGroupId(int $groupId) : Collection|null
Parameters
- $groupId : int
Return values
Collection|nullgetPrivacyFromAlbum()
public
getPrivacyFromAlbum(int|null $albumId, array<string|int, mixed> $attributes[, Photo|null $photo = null ]) : array<string, mixed>
Parameters
- $albumId : int|null
- $attributes : array<string|int, mixed>
- $photo : Photo|null = null
Return values
array<string, 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
CollectiongetSponsoredItem()
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|nullgetTaggedFriends()
public
getTaggedFriends(User $context, int $photoId) : Collection
Parameters
- $context : User
- $photoId : int
Tags
Return values
CollectiongetTotalItemByPeriod()
public
getTotalItemByPeriod([Carbon|null $after = null ][, Carbon|null $before = null ]) : int
Parameters
- $after : Carbon|null = null
- $before : Carbon|null = null
Return values
intgetTotalPendingItemByPeriod()
public
getTotalPendingItemByPeriod([Carbon|null $after = null ][, Carbon|null $before = null ][, array<string|int, mixed>|null $where = null ]) : int
Parameters
- $after : Carbon|null = null
- $before : Carbon|null = null
- $where : array<string|int, mixed>|null = null
Return values
intgetUserContractMorphTypeColumns()
public
getUserContractMorphTypeColumns() : array<string|int, string>
Return values
array<string|int, string>hasSponsorView()
public
hasSponsorView(array<string|int, mixed> $attributes) : bool
Parameters
- $attributes : array<string|int, mixed>
Return values
boolisFeature()
public
isFeature(Content $model) : bool
Parameters
- $model : Content
Return values
boolisFeedSponsored()
public
isFeedSponsored(Content $model) : bool
Parameters
- $model : Content
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
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
stringmakeParentAvatar()
public
makeParentAvatar(User $context, int $id[, User|null $owner = null ][, string|null $imageCrop = null ]) : array<string, mixed>|null
Parameters
Tags
Return values
array<string, mixed>|nullmakeParentCover()
public
makeParentCover(User $context, int $id) : bool
Parameters
- $context : User
- $id : int
Return values
boolmakeProfileAvatar()
public
makeProfileAvatar(User $context, int $id[, string|null $imageCrop = null ]) : array<string, mixed>|null
Parameters
- $context : User
- $id : int
- $imageCrop : string|null = null
Tags
Return values
array<string, mixed>|nullmakeProfileCover()
public
makeProfileCover(User $context, int $id[, array<string, mixed> $attributes = [] ]) : bool
Parameters
- $context : User
- $id : int
- $attributes : array<string, mixed> = []
Tags
Return values
boolmodel()
public
model() : string
Return values
stringnewModelInstance()
public
newModelInstance() : Photo
Return values
PhotoremoveMentionsFromContent()
public
removeMentionsFromContent(string|null $content, array<string|int, mixed> $removedIds) : string|null
Parameters
- $content : string|null
- $removedIds : array<string|int, mixed>
Return values
string|nullsponsor()
public
sponsor(User $context, int $id, int $sponsor) : bool
Parameters
- $context : User
- $id : int
- $sponsor : int
Tags
Return values
boolsponsorInFeed()
public
sponsorInFeed(User $context, int $id, int $newValue) : bool
Parameters
- $context : User
- $id : int
- $newValue : int
Tags
Return values
booltagFriend()
public
tagFriend(User $user, User $friend, int $photoId, float $pxValue, float $pyValue) : TagFriendModel
Parameters
Return values
TagFriendModeltempFileToExistPhoto()
public
tempFileToExistPhoto(User $user, User $owner, Photo $photo, TempFileModel $tempFile[, array<string|int, mixed> $params = [] ]) : Photo
Parameters
- $user : User
- $owner : User
- $photo : Photo
- $tempFile : TempFileModel
- $params : array<string|int, mixed> = []
Tags
Return values
PhototempFileToPhoto()
public
tempFileToPhoto(User $user, User $owner, TempFileModel $tempFile[, array<string|int, mixed> $params = [] ]) : Photo
Parameters
- $user : User
- $owner : User
- $tempFile : TempFileModel
- $params : array<string|int, mixed> = []
Return values
PhototransformTaggedFriends()
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>unsponsor()
public
unsponsor(User $context, int $id) : bool
Parameters
- $context : User
- $id : int
Return values
boolunsponsorInFeed()
public
unsponsorInFeed(User $context, int $id) : bool
Parameters
- $context : User
- $id : int
Return values
boolupdateAvatarPath()
public
updateAvatarPath(int $photoId, string $path[, array<string|int, mixed> $sizes = [] ][, array<string|int, mixed> $squareSizes = [] ]) : string
Parameters
- $photoId : int
- $path : string
- $sizes : array<string|int, mixed> = []
- $squareSizes : array<string|int, mixed> = []
Return values
stringupdatePhoto()
public
updatePhoto(User $context, int $id, array<string|int, mixed> $attributes) : Photo
Parameters
- $context : User
- $id : int
- $attributes : array<string|int, mixed>
Return values
PhotouploadMedias()
public
uploadMedias(User $context, User $owner, array<string, mixed> $attributes) : PhotoGroup
Parameters
Tags
Return values
PhotoGroupviewPhoto()
public
viewPhoto(User $context, int $id) : Photo
Parameters
- $context : User
- $id : int
Return values
PhotoviewPhotos()
public
viewPhotos(User $context, User $owner[, array<string|int, mixed> $attributes = [] ]) : Paginator
Parameters
Return values
PaginatorviewPhotoSet()
public
viewPhotoSet(User $user, int $id) : PhotoGroup
Parameters
- $user : User
- $id : int
Return values
PhotoGroupwhere()
public
where(array<string|int, mixed> $params) : $this
Parameters
- $params : array<string|int, mixed>
Tags
Return values
$thiswithUserMorphTypeActiveScope()
public
withUserMorphTypeActiveScope() : self
Return values
selfgetPrivacyForDefaultAlbum()
protected
getPrivacyForDefaultAlbum(int $albumId, Photo $photo, array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
- $albumId : int
- $photo : Photo
- $attributes : array<string|int, mixed>
Return values
array<string|int, mixed>getPrivacyForNormalAlbum()
protected
getPrivacyForNormalAlbum(Album $album, array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
- $album : Album
- $attributes : array<string|int, mixed>
Return values
array<string|int, mixed>getPrivacyForRemovingAlbum()
protected
getPrivacyForRemovingAlbum(Photo|null $photo, array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
- $photo : Photo|null
- $attributes : array<string|int, mixed>
Return values
array<string|int, mixed>handleBase64()
protected
handleBase64(Photo $photo, string $base64) : void
Parameters
- $photo : Photo
- $base64 : string
handleMentionedUsers()
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>handleMultipleTagFriends()
protected
handleMultipleTagFriends(Photo $photo, array<string|int, mixed> $tags) : void
Parameters
- $photo : Photo
- $tags : array<string|int, mixed>
handleTaggedFriends()
protected
handleTaggedFriends(User $user, Photo $photo, array<string|int, mixed> $keptTaggedFriends) : bool
Parameters
Return values
boolhandleTaggedUsers()
protected
handleTaggedUsers(User $context, User $user, User $owner, array<string|int, mixed> $taggedUsers) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed>prepareDataForGroupUpdate()
protected
prepareDataForGroupUpdate(PhotoGroup|null $photoGroup, Photo $photo, array<string|int, mixed> &$attributes, array<string|int, mixed>|null &$groupAttributes) : void
Parameters
- $photoGroup : PhotoGroup|null
- $photo : Photo
- $attributes : array<string|int, mixed>
- $groupAttributes : array<string|int, mixed>|null
setContent()
protected
setContent(array<string|int, mixed> &$attributes) : void
Parameters
- $attributes : array<string|int, mixed>
unsetContent()
protected
unsetContent(array<string|int, mixed> &$attributes) : mixed
Parameters
- $attributes : array<string|int, mixed>
updateGlobalSearch()
protected
updateGlobalSearch(Photo $photo, string|null $text) : bool|null
Parameters
- $photo : Photo
- $text : string|null
Return values
bool|nulluploadProfileCover()
protected
uploadProfileCover(Photo $photo) : UploadedFile|null
Parameters
- $photo : Photo
Return values
UploadedFile|nulluploadRawFile()
protected
uploadRawFile(User $context, UploadedFile $file, array<string, mixed> $params) : StorageFile
Parameters
- $context : User
- $file : UploadedFile
- $params : array<string, mixed>
Return values
StorageFileapplyDisplayPhotoSetting()
private
applyDisplayPhotoSetting(Builder $query, User $owner, string $view) : Builder
Parameters
- $query : Builder
- $owner : User
- $view : string
Tags
Return values
BuilderbuildQueryPhotos()
private
buildQueryPhotos(User $context, User $owner, array<string, mixed> $attributes) : Builder
Parameters
Tags
Return values
BuildercategoryRepository()
private
categoryRepository() : CategoryRepositoryInterface
Return values
CategoryRepositoryInterfacecheckPhotoQuota()
private
checkPhotoQuota(User $context, mixed $files) : void
Parameters
- $context : User
- $files : mixed
checkUserUploadAvatarOrCover()
private
checkUserUploadAvatarOrCover(string|null $type) : bool
Parameters
- $type : string|null
Return values
boolgetAlbumRepository()
private
getAlbumRepository() : AlbumRepositoryInterface
Return values
AlbumRepositoryInterfacephotoGroupRepository()
private
photoGroupRepository() : PhotoGroupRepositoryInterface
Return values
PhotoGroupRepositoryInterfaceuserRepository()
private
userRepository() : UserRepositoryInterface