All methods below are provided by EloquentWorks\Fellowship\Traits\HasFellowships.
Method
Return type
Description
sentFellowships()
HasMany
All records where the model is the sender.
receivedFellowships()
HasMany
All records where the model is the recipient.
acceptedSentFellowships()
HasMany
Accepted records sent by the model.
acceptedReceivedFellowships()
HasMany
Accepted records received by the model.
pendingSentFellowships()
HasMany
Pending records sent by the model.
pendingReceivedFellowships()
HasMany
Pending records received by the model.
Method
Return type
Description
sendFellowshipRequestTo(Model $user)
Fellowship
Creates or resends a Fellowship request.
acceptFellowshipRequestFrom(Model $user)
bool
Accepts a received pending request.
denyFellowshipRequestFrom(Model $user)
bool
Denies a received pending request.
cancelFellowshipRequestTo(Model $user)
bool
Cancels an outgoing pending request.
removeFellowship(Model $user)
bool
Removes an accepted Fellowship.
removeFellowshipWith(Model $user)
bool
Compatibility alias for removeFellowship().
blockFellowship(Model $user)
Fellowship
Creates or updates a blocked relationship.
unblockFellowship(Model $user)
bool
Removes a block created by the current model.
🔎 Queries and collections
Method
Return type
Description
friends()
Collection
Accepted related user models.
incomingFellowshipRequests()
Collection
Non-expired incoming pending requests.
outgoingFellowshipRequests()
Collection
Non-expired outgoing pending requests.
blockedUsers()
Collection
Users blocked by the current model.
blockedByUsers()
Collection
Users who blocked the current model.
fellowshipWith(Model $user)
?Fellowship
Relationship record for the pair.
fellowshipStatusWith(Model $user)
?string
Current status or null.
Method
Return type
Description
isFellowshipWith(Model $user)
bool
Whether the pair has an accepted Fellowship.
hasBlocked(Model $user)
bool
Whether the current model blocked the user.
isBlockedBy(Model $user)
bool
Whether the other user blocked the current model.
hasPendingFellowshipRequestWith(Model $user)
bool
Whether a non-expired pending request exists in either direction.
canSendFellowshipRequestTo(Model $user)
bool
Whether sending would pass current package rules.
👥 Counts and mutual connections
Method
Return type
Description
fellowshipCount()
int
Number of accepted Fellowships.
fellowshipsCount()
int
Plural compatibility count method.
mutualFellowshipWith(Model $user)
Collection
Mutual accepted related users.
mutualFellowshipCountWith(Model $user)
int
Number of mutual accepted users.
mutualFellowshipsWith(Model $user)
Collection
Plural compatibility method.
mutualFellowshipsCountWith(Model $user)
int
Plural compatibility count method.
Operations may throw LogicException when an action violates package rules, including:
Sending a request to the same model
Sending while either side has blocked the other
Sending when an accepted or pending relationship already exists
Resending before the cooldown ends
Unblocking a block created by the other user