UserRepository
extends AbstractRepository
in package
implements
UserRepositoryInterface
Uses
HasFeatured, CollectTotalItemStatTrait, HasValidateUserTrait
Class UserRepositoryRepository.
Tags
Table of Contents
Interfaces
- UserRepositoryInterface
- Interface User.
Properties
- $model : User
- $disableSponsor : mixed
- $skipPresenter : mixed
Methods
- approve() : Content
- assignRole() : User
- Add role/roles to an user.
- banUser() : bool
- Ban an user.
- boot() : void
- Boot up the repository, pushing criteria.
- buildQueryScopes() : mixed
- cancelAccount() : bool
- cleanContent() : string|null
- cleanTitle() : string|null
- cleanUpDeletedUser() : void
- cleanUpExpiredBanData() : bool
- Clean all expired ban data.
- create() : User
- createAvatar() : void
- createAvatarFromSignup() : void
- createMany() : bool
- createUser() : User|null
- deleteUser() : bool
- denyUser() : Content
- feature() : bool
- find() : User
- findAndValidateForAuth() : User|null
- Find an user for authentication.
- findUserByEmail() : User|null
- Find an user by email.
- findUserByEmailOrPhoneNumber() : User|null
- Find an user by email or phone.
- getAdminAndStaffOptions() : array<int, mixed>
- getBan() : UserBan|null
- Get ban data of an user.
- getChangeableProfileFields() : array<string|int, mixed>
- getInvisibleSettings() : array<string, mixed>
- getItemExtraStatistics() : array<string, mixed>
- getModel() : User
- getOnlineUserCount() : int
- getOnlineUserCount.
- getPendingUserCount() : int
- getPendingUserCount.
- getSuperAdmin() : User|null
- getTotalItemByPeriod() : int
- getTotalPendingItemByPeriod() : int
- getUserByRoleId() : User
- getUserContractMorphTypeColumns() : array<string|int, string>
- getUsersByRoleId() : Collection|null
- getVerifyBy() : string|null
- getVerifyMessage() : string|null
- hasSponsorView() : bool
- isBanned() : bool
- Check is banned.
- isFeature() : bool
- isNoSponsorView() : bool
- likeOperator() : string
- return the case-insensitive LIKE operator bases on the current database driver.
- model() : string
- Specify Model class name.
- presenter() : string
- Include presenter.
- pushProfileFeed() : void
- removeBanUser() : bool
- Remove user from ban.
- removeCover() : bool
- removeRole() : User
- Remove an user role.
- searchBlockUser() : mixed
- update() : User
- updateAvatar() : array<string, mixed>
- updateCover() : array<string, mixed>
- updateThemePreference() : void
- Update user profile config which being stored in User value table.
- updateUser() : User
- updateVideosSettings() : User
- uploadAvatar() : array<string, mixed>
- validateStatuses() : void
- validateVerifiedBy() : void
- viewUser() : User
- View a user.
- viewUsers() : Paginator
- Browse users.
- where() : $this
- withUserMorphTypeActiveScope() : self
- buildQueryViewUsers() : Builder
- createPhoto() : Collection|null
- getMessageTextForOldMobileVersion() : string
- getProfileFeedAction() : FeedAction|null
- getUsersByLocation() : Collection
- handleProfileFeed() : void
- handleRelationshipFeed() : void
- handleVerify() : array<string|int, mixed>
- isOldMobileVersion() : bool
- isProfileChanged() : bool
- isRelationshipChanged() : bool
- isRelationshipChanged.
- mustVerifyEmail() : bool
- mustVerifyPhoneNumber() : bool
- getBannedParams() : array<string|int, mixed>
- transformBannedReason() : string|null
- validateApproved() : void
- validateBanned() : void
- validateEmailAddress() : mixed
- validatePhoneNumber() : void
- validateVerified() : mixed
Properties
$model
public
User
$model
$disableSponsor
protected
mixed
$disableSponsor
$skipPresenter
protected
mixed
$skipPresenter
= true
Methods
approve()
public
approve(User $context, int $id) : Content
Parameters
- $context : User
- $id : int
Tags
Return values
ContentassignRole()
Add role/roles to an user.
public
assignRole(int $userId, mixed $roles) : User
Parameters
- $userId : int
- $roles : mixed
Return values
UserbanUser()
Ban an user.
public
banUser(User $user, User $owner[, mixed $day = 0 ][, mixed $returnUserGroup = UserRole::NORMAL_USER_ID ][, mixed $reason = null ]) : bool
Parameters
- $user : User
- $owner : User
- $day : mixed = 0
- $returnUserGroup : mixed = UserRole::NORMAL_USER_ID
- $reason : mixed = null
Return values
boolboot()
Boot up the repository, pushing criteria.
public
boot() : void
Tags
buildQueryScopes()
public
buildQueryScopes(mixed $query, mixed $model, mixed $criteria) : mixed
Parameters
- $query : mixed
- $model : mixed
- $criteria : mixed
cancelAccount()
public
cancelAccount(User $context, int $id, array<string, mixed> $params) : bool
Parameters
- $context : User
- $id : int
- $params : array<string, mixed>
Tags
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|nullcleanUpDeletedUser()
public
cleanUpDeletedUser([int $period = 1 ]) : void
Parameters
- $period : int = 1
-
Users are deleted after this period of days shall be applicable
cleanUpExpiredBanData()
Clean all expired ban data.
public
cleanUpExpiredBanData() : bool
Return values
boolcreate()
public
create(array<string, mixed> $params) : User
Parameters
- $params : array<string, mixed>
Tags
Return values
UsercreateAvatar()
public
createAvatar(User $context, UploadedFile $image, array<string|int, mixed> $params) : void
Parameters
- $context : User
- $image : UploadedFile
- $params : array<string|int, mixed>
createAvatarFromSignup()
public
createAvatarFromSignup(User $context, UploadedFile $image, array<string, mixed> $params) : void
Parameters
- $context : User
- $image : UploadedFile
- $params : array<string, mixed>
Tags
createMany()
public
createMany(array<string|int, mixed> $items) : bool
Parameters
- $items : array<string|int, mixed>
Return values
boolcreateUser()
public
createUser(array<string|int, mixed> $attributes) : User|null
Parameters
- $attributes : array<string|int, mixed>
Tags
Return values
User|nulldeleteUser()
public
deleteUser(User $context, int $id) : bool
Parameters
- $context : User
- $id : int
Return values
booldenyUser()
public
denyUser(User $context, int $id, array<string|int, mixed> $attributes) : Content
Parameters
- $context : User
- $id : int
- $attributes : array<string|int, mixed>
Tags
Return values
Contentfeature()
public
feature(User $context, int $id, int $feature) : bool
Parameters
- $context : User
- $id : int
- $feature : int
Return values
boolfind()
public
find(mixed $id, mixed $columns) : User
Parameters
- $id : mixed
- $columns : mixed
Return values
UserfindAndValidateForAuth()
Find an user for authentication.
public
findAndValidateForAuth(string $username, string $password) : User|null
Parameters
- $username : string
- $password : string
Return values
User|nullfindUserByEmail()
Find an user by email.
public
findUserByEmail(string $email) : User|null
Parameters
- $email : string
Return values
User|nullfindUserByEmailOrPhoneNumber()
Find an user by email or phone.
public
findUserByEmailOrPhoneNumber(string $value) : User|null
Parameters
- $value : string
Return values
User|nullgetAdminAndStaffOptions()
public
getAdminAndStaffOptions() : array<int, mixed>
Return values
array<int, mixed>getBan()
Get ban data of an user.
public
getBan(int $userId) : UserBan|null
Parameters
- $userId : int
Return values
UserBan|nullgetChangeableProfileFields()
public
getChangeableProfileFields() : array<string|int, mixed>
Return values
array<string|int, mixed>getInvisibleSettings()
public
getInvisibleSettings(User $context) : array<string, mixed>
Parameters
- $context : User
Tags
Return values
array<string, mixed>getItemExtraStatistics()
public
getItemExtraStatistics(User $context, User $user, string $itemType, int $itemId) : array<string, mixed>
Parameters
Tags
Return values
array<string, mixed>getModel()
public
getModel() : User
Return values
UsergetOnlineUserCount()
getOnlineUserCount.
public
getOnlineUserCount() : int
Return values
intgetPendingUserCount()
getPendingUserCount.
public
getPendingUserCount() : int
Return values
intgetSuperAdmin()
public
getSuperAdmin() : User|null
Return values
User|nullgetTotalItemByPeriod()
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
intgetUserByRoleId()
public
getUserByRoleId(int $roleId) : User
Parameters
- $roleId : int
Return values
UsergetUserContractMorphTypeColumns()
public
getUserContractMorphTypeColumns() : array<string|int, string>
Return values
array<string|int, string>getUsersByRoleId()
public
getUsersByRoleId(int $roleId) : Collection|null
Parameters
- $roleId : int
Tags
Return values
Collection|nullgetVerifyBy()
public
getVerifyBy(User $user, string $value) : string|null
Parameters
- $user : User
- $value : string
Return values
string|nullgetVerifyMessage()
public
getVerifyMessage(string|null $email, string|null $phoneNumber, array<string|int, mixed> $params) : string|null
Parameters
- $email : string|null
- $phoneNumber : string|null
- $params : array<string|int, mixed>
Return values
string|nullhasSponsorView()
public
hasSponsorView(array<string|int, mixed> $attributes) : bool
Parameters
- $attributes : array<string|int, mixed>
Return values
boolisBanned()
Check is banned.
public
isBanned(int $userId) : bool
Parameters
- $userId : int
Return values
boolisFeature()
public
isFeature(Content $model) : bool
Parameters
- $model : Content
Return values
boolisNoSponsorView()
public
isNoSponsorView(string|null $view) : bool
Parameters
- $view : string|null
Return values
boollikeOperator()
return the case-insensitive LIKE operator bases on the current database driver.
public
likeOperator() : string
Return values
stringmodel()
Specify Model class name.
public
model() : string
Return values
stringpresenter()
Include presenter.
public
presenter() : string
Return values
stringpushProfileFeed()
public
pushProfileFeed(User $user) : void
Parameters
- $user : User
removeBanUser()
Remove user from ban.
public
removeBanUser(User $user, User $owner) : bool
Parameters
Return values
boolremoveCover()
public
removeCover(User $context, int $id) : bool
Parameters
- $context : User
- $id : int
Return values
boolremoveRole()
Remove an user role.
public
removeRole(int $userId, mixed $role) : User
Parameters
- $userId : int
- $role : mixed
Return values
UsersearchBlockUser()
public
searchBlockUser(User $user, string $search) : mixed
Parameters
- $user : User
- $search : string
update()
public
update(array<string, mixed> $attributes, int $id) : User
Parameters
- $attributes : array<string, mixed>
- $id : int
Tags
Return values
UserupdateAvatar()
public
updateAvatar(User $context, User $owner, array<string, mixed> $attribute) : array<string, mixed>
Parameters
Tags
Return values
array<string, mixed>updateCover()
public
updateCover(User $context, User $owner, array<string|int, mixed> $attributes) : array<string, mixed>
Parameters
Return values
array<string, mixed>updateThemePreference()
Update user profile config which being stored in User value table.
public
updateThemePreference(User $user[, array<string|int, mixed> $attributes = [] ]) : void
Parameters
- $user : User
- $attributes : array<string|int, mixed> = []
Tags
updateUser()
public
updateUser(User $context, int $id, array<string|int, mixed> $attributes) : User
Parameters
- $context : User
- $id : int
- $attributes : array<string|int, mixed>
Tags
Return values
UserupdateVideosSettings()
public
updateVideosSettings(User $context, User $user, array<string|int, mixed> $attributes) : User
Parameters
Tags
Return values
UseruploadAvatar()
public
uploadAvatar(User $context, User $owner, array<string|int, mixed> $attributes) : array<string, mixed>
Parameters
Tags
Return values
array<string, mixed>validateStatuses()
public
validateStatuses(User $user) : void
Parameters
- $user : User
validateVerifiedBy()
public
validateVerifiedBy(User $user, string $verifyBy) : void
Parameters
- $user : User
- $verifyBy : string
viewUser()
View a user.
public
viewUser(User $context, int $id) : User
Parameters
- $context : User
- $id : int
Return values
UserviewUsers()
Browse users.
public
viewUsers(User $context, array<string|int, mixed> $attributes) : Paginator
Parameters
- $context : User
- $attributes : array<string|int, mixed>
Return values
Paginatorwhere()
public
where(array<string|int, mixed> $params) : $this
Parameters
- $params : array<string|int, mixed>
Tags
Return values
$thiswithUserMorphTypeActiveScope()
public
withUserMorphTypeActiveScope() : self
Return values
selfbuildQueryViewUsers()
protected
buildQueryViewUsers(User $context, array<string, mixed> $attributes) : Builder
Parameters
- $context : User
- $attributes : array<string, mixed>
Tags
Return values
BuildercreatePhoto()
protected
createPhoto(User $context, User $owner, array<string, mixed> $params, int $albumType[, string|null $typeId = null ]) : Collection|null
Parameters
- $context : User
- $owner : User
- $params : array<string, mixed>
- $albumType : int
- $typeId : string|null = null
Return values
Collection|nullgetMessageTextForOldMobileVersion()
protected
getMessageTextForOldMobileVersion(string|null $reason, int $time) : string
Parameters
- $reason : string|null
- $time : int
Tags
Return values
stringgetProfileFeedAction()
protected
getProfileFeedAction(User $user) : FeedAction|null
Parameters
- $user : User
Return values
FeedAction|nullgetUsersByLocation()
protected
getUsersByLocation(User $context) : Collection
Parameters
- $context : User
Return values
CollectionhandleProfileFeed()
protected
handleProfileFeed(User $user, array<string|int, mixed> $attributes) : void
Parameters
- $user : User
- $attributes : array<string|int, mixed>
handleRelationshipFeed()
protected
handleRelationshipFeed(User $context, array<string|int, mixed> $attributes) : void
Parameters
- $context : User
- $attributes : array<string|int, mixed>
handleVerify()
protected
handleVerify(User $user, array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $user : User
- $params : array<string|int, mixed>
Return values
array<string|int, mixed>isOldMobileVersion()
protected
isOldMobileVersion() : bool
Tags
Return values
boolisProfileChanged()
protected
isProfileChanged(array<string|int, mixed> $newProfile, array<string|int, mixed> $oldProfile) : bool
Parameters
- $newProfile : array<string|int, mixed>
- $oldProfile : array<string|int, mixed>
Return values
boolisRelationshipChanged()
isRelationshipChanged.
protected
isRelationshipChanged(array<string|int, mixed> $newProfile, array<string|int, mixed> $oldProfile) : bool
Parameters
- $newProfile : array<string|int, mixed>
- $oldProfile : array<string|int, mixed>
Return values
boolmustVerifyEmail()
protected
mustVerifyEmail(string|null $email, array<string|int, mixed> $params) : bool
Parameters
- $email : string|null
- $params : array<string|int, mixed>
Return values
boolmustVerifyPhoneNumber()
protected
mustVerifyPhoneNumber(string|null $phoneNumber, array<string|int, mixed> $params) : bool
Parameters
- $phoneNumber : string|null
- $params : array<string|int, mixed>
Return values
boolgetBannedParams()
private
getBannedParams(UserBan $userBanned) : array<string|int, mixed>
Parameters
- $userBanned : UserBan
Return values
array<string|int, mixed>transformBannedReason()
private
transformBannedReason(string|null $reason) : string|null
Parameters
- $reason : string|null
Return values
string|nullvalidateApproved()
private
validateApproved(User $user) : void
Parameters
- $user : User
validateBanned()
private
validateBanned(User $user) : void
Parameters
- $user : User
validateEmailAddress()
private
validateEmailAddress(User $user) : mixed
Parameters
- $user : User
validatePhoneNumber()
private
validatePhoneNumber(User $user) : void
Parameters
- $user : User
validateVerified()
private
validateVerified(User $user) : mixed
Parameters
- $user : User