Friend
        
        extends Model
    
    
            
            in package
            
        
    
            
            implements
                            Membership,                             IsActivitySubscriptionInterface,                             IsPrivacyItemInterface,                             ActivityFeedSource,                             HasUrl                    
    
            
            Uses
                            HasEntity,                             HasFeed,                             HasUserMorph,                             HasOwnerMorph,                             HasFactory                    
    
Class Friend.
Tags
Table of Contents
Interfaces
- Membership
 - Interface Entity.
 - IsActivitySubscriptionInterface
 - IsPrivacyItemInterface
 - ActivityFeedSource
 - Interface ActivityFeedSource.
 - HasUrl
 
Constants
- ENTITY_TYPE = 'friend'
 - PRIVACY_FRIENDS = 'user_friends'
 
Properties
- $id : int
 - $owner : User
 - $owner_id : int
 - $owner_type : int
 - $user_id : int
 - $user_type : string
 - $fillable : mixed
 
Methods
- activity_feed() : MorphOne|null
 - Morph Relation.
 - entityId() : int
 - entityType() : string
 - factory() : FriendFactory
 - getActivityFeedAttribute() : mixed
 - getOwnerAttribute() : mixed
 - getOwnerEntityAttribute() : mixed
 - getUserAttribute() : mixed
 - getUserEntityAttribute() : mixed
 - isOwner() : bool
 - check if $user is the owner of entity.
 - isUser() : bool
 - check if $user is the user (creator) of entity.
 - moduleName() : string
 - owner() : MorphTo
 - ownerEntity() : BelongsTo
 - ownerId() : int
 - ownerType() : string
 - privacy() : int|null
 - privacyUserId() : int|null
 - shouldSubscribe() : bool
 - toActivityFeed() : FeedAction|null
 - toActivitySubscription() : array<string|int, int>
 - This method must return [$userId, $ownerId] $userId: who subscribe $ownerId: whom subscribe from When $owner post content on profile, $userId can see $owner feed.
 - toLink() : string|null
 - toPrivacyItem() : array<string|int, mixed>
 - Result [ [$userId, $itemId, $itemType, $privacyType] ] $userId: to Insert into privacy_data $itemId: $itemType, $privacyType: to find privacy_id.
 - toRouter() : string|null
 - toUrl() : string|null
 - user() : MorphTo
 - userEntity() : BelongsTo
 - userId() : int
 - userType() : string
 - newFactory() : FriendFactory
 
Constants
ENTITY_TYPE
    public
        mixed
    ENTITY_TYPE
    = 'friend'
    
    
    
PRIVACY_FRIENDS
    public
        mixed
    PRIVACY_FRIENDS
    = 'user_friends'
    
    
    
Properties
$id
    public
        int
    $id
    
    
    
    
$owner
    public
        User
    $owner
    
    
    
    
$owner_id
    public
        int
    $owner_id
    
    
    
    
$owner_type
    public
        int
    $owner_type
    
    
    
    
$user_id
    public
        int
    $user_id
    
    
    
    
$user_type
    public
        string
    $user_type
    
    
    
    
$fillable
    protected
        mixed
    $fillable
     = ['user_id', 'user_type', 'owner_id', 'owner_type']
    
    
    
Methods
activity_feed()
Morph Relation.
    public
                    activity_feed() : MorphOne|null
    Tags
Return values
MorphOne|nullentityId()
    public
                    entityId() : int
    Return values
intentityType()
    public
                    entityType() : string
    Return values
stringfactory()
    public
            static        factory() : FriendFactory
    Return values
FriendFactorygetActivityFeedAttribute()
    public
                    getActivityFeedAttribute() : mixed
    getOwnerAttribute()
    public
                    getOwnerAttribute() : mixed
    getOwnerEntityAttribute()
    public
                    getOwnerEntityAttribute() : mixed
    getUserAttribute()
    public
                    getUserAttribute() : mixed
    getUserEntityAttribute()
    public
                    getUserEntityAttribute() : mixed
    isOwner()
check if $user is the owner of entity.
    public
                    isOwner(User $user) : bool
    Parameters
- $user : User
 
Return values
boolisUser()
check if $user is the user (creator) of entity.
    public
                    isUser(User $user) : bool
    Parameters
- $user : User
 
Return values
boolmoduleName()
    public
                    moduleName() : string
    Return values
stringowner()
    public
                    owner() : MorphTo
    Return values
MorphToownerEntity()
    public
                    ownerEntity() : BelongsTo
    Return values
BelongsToownerId()
    public
                    ownerId() : int
    Return values
intownerType()
    public
                    ownerType() : string
    Return values
stringprivacy()
    public
                    privacy() : int|null
    Return values
int|nullprivacyUserId()
    public
                    privacyUserId() : int|null
    Return values
int|nullshouldSubscribe()
    public
                    shouldSubscribe() : bool
    Return values
booltoActivityFeed()
    public
                    toActivityFeed() : FeedAction|null
    Return values
FeedAction|nulltoActivitySubscription()
This method must return [$userId, $ownerId] $userId: who subscribe $ownerId: whom subscribe from When $owner post content on profile, $userId can see $owner feed.
    public
                    toActivitySubscription() : array<string|int, int>
    Return values
array<string|int, int>toLink()
    public
                    toLink() : string|null
    Return values
string|nulltoPrivacyItem()
Result [ [$userId, $itemId, $itemType, $privacyType] ] $userId: to Insert into privacy_data $itemId: $itemType, $privacyType: to find privacy_id.
    public
                    toPrivacyItem() : array<string|int, mixed>
    Return values
array<string|int, mixed>toRouter()
    public
                    toRouter() : string|null
    Return values
string|nulltoUrl()
    public
                    toUrl() : string|null
    Return values
string|nulluser()
    public
                    user() : MorphTo
    Return values
MorphTouserEntity()
    public
                    userEntity() : BelongsTo
    Return values
BelongsTouserId()
    public
                    userId() : int
    Return values
intuserType()
    public
                    userType() : string
    Return values
stringnewFactory()
    protected
            static        newFactory() : FriendFactory