PHP Trait Hootlex\Friendships\Traits\Friendable

Datei anzeigen Open project: hootlex/laravel-friendships

Public Methods

Method Description
acceptFriendRequest ( Model $recipient ) : boolean | integer
befriend ( Model $recipient ) : Friendship | false
blockFriend ( Model $recipient ) : Friendship
canBefriend ( Model $recipient ) : boolean
denyFriendRequest ( Model $recipient ) : boolean | integer
friends ( ) : Illuminate\Database\Eloquent\Relations\MorphMany
getAcceptedFriendships ( string $groupSlug = '' ) : Illuminate\Database\Eloquent\Collection
getAllFriendships ( string $groupSlug = '' ) : Illuminate\Database\Eloquent\Collection
getBlockedFriendships ( ) : Illuminate\Database\Eloquent\Collection
getDeniedFriendships ( ) : Illuminate\Database\Eloquent\Collection
getFriendRequests ( ) : Illuminate\Database\Eloquent\Collection
getFriends ( integer $perPage, string $groupSlug = '' ) : Illuminate\Database\Eloquent\Collection This method will not return Friendship models It will return the 'friends' models. ex: App\User
getFriendsCount ( string $groupSlug = '' ) : integer Get the number of friends
getFriendsOfFriends ( integer $perPage ) : Illuminate\Database\Eloquent\Collection This method will not return Friendship models It will return the 'friends' models. ex: App\User
getFriendship ( Model $recipient ) : Friendship
getMutualFriends ( Model $other, integer $perPage ) : Illuminate\Database\Eloquent\Collection This method will not return Friendship models It will return the 'friends' models. ex: App\User
getMutualFriendsCount ( $other ) : integer Get the number of friends
getPendingFriendships ( string $groupSlug = '' ) : Illuminate\Database\Eloquent\Collection
groupFriend ( Model $friend, $groupSlug ) : boolean
groups ( ) : Illuminate\Database\Eloquent\Relations\MorphMany
hasBlocked ( Model $recipient ) : boolean
hasFriendRequestFrom ( Model $recipient ) : boolean
hasSentFriendRequestTo ( Model $recipient ) : boolean
isBlockedBy ( Model $recipient ) : boolean
isFriendWith ( Model $recipient ) : boolean
unblockFriend ( Model $recipient ) : mixed
unfriend ( Model $recipient ) : boolean
ungroupFriend ( Model $friend, $groupSlug = '' ) : boolean

Protected Methods

Method Description
getOrPaginate ( $builder, $perPage )

Private Methods

Method Description
findFriendship ( Model $recipient ) : Builder
findFriendships ( $status = null, string $groupSlug = '' ) : Illuminate\Database\Eloquent\Collection
friendsOfFriendsQueryBuilder ( string $groupSlug = '' ) : Builder Get the query builder for friendsOfFriends ('friend' model)
getFriendsQueryBuilder ( string $groupSlug = '' ) : Builder Get the query builder of the 'friend' model
getMutualFriendsQueryBuilder ( Model $other ) : Builder Get the query builder of the 'friend' model

Method Details

acceptFriendRequest() public method

public acceptFriendRequest ( Model $recipient ) : boolean | integer
$recipient Illuminate\Database\Eloquent\Model
return boolean | integer

befriend() public method

public befriend ( Model $recipient ) : Friendship | false
$recipient Illuminate\Database\Eloquent\Model
return Hootlex\Friendships\Models\Friendship | false

blockFriend() public method

public blockFriend ( Model $recipient ) : Friendship
$recipient Illuminate\Database\Eloquent\Model
return Hootlex\Friendships\Models\Friendship

canBefriend() public method

public canBefriend ( Model $recipient ) : boolean
$recipient Illuminate\Database\Eloquent\Model
return boolean

denyFriendRequest() public method

public denyFriendRequest ( Model $recipient ) : boolean | integer
$recipient Illuminate\Database\Eloquent\Model
return boolean | integer

friends() public method

public friends ( ) : Illuminate\Database\Eloquent\Relations\MorphMany
return Illuminate\Database\Eloquent\Relations\MorphMany

getAcceptedFriendships() public method

public getAcceptedFriendships ( string $groupSlug = '' ) : Illuminate\Database\Eloquent\Collection
$groupSlug string
return Illuminate\Database\Eloquent\Collection

getAllFriendships() public method

public getAllFriendships ( string $groupSlug = '' ) : Illuminate\Database\Eloquent\Collection
$groupSlug string
return Illuminate\Database\Eloquent\Collection

getBlockedFriendships() public method

public getBlockedFriendships ( ) : Illuminate\Database\Eloquent\Collection
return Illuminate\Database\Eloquent\Collection

getDeniedFriendships() public method

public getDeniedFriendships ( ) : Illuminate\Database\Eloquent\Collection
return Illuminate\Database\Eloquent\Collection

getFriendRequests() public method

public getFriendRequests ( ) : Illuminate\Database\Eloquent\Collection
return Illuminate\Database\Eloquent\Collection

getFriends() public method

This method will not return Friendship models It will return the 'friends' models. ex: App\User
public getFriends ( integer $perPage, string $groupSlug = '' ) : Illuminate\Database\Eloquent\Collection
$perPage integer Number
$groupSlug string
return Illuminate\Database\Eloquent\Collection

getFriendsCount() public method

Get the number of friends
public getFriendsCount ( string $groupSlug = '' ) : integer
$groupSlug string
return integer

getFriendsOfFriends() public method

This method will not return Friendship models It will return the 'friends' models. ex: App\User
public getFriendsOfFriends ( integer $perPage ) : Illuminate\Database\Eloquent\Collection
$perPage integer Number
return Illuminate\Database\Eloquent\Collection

getFriendship() public method

public getFriendship ( Model $recipient ) : Friendship
$recipient Illuminate\Database\Eloquent\Model
return Hootlex\Friendships\Models\Friendship

getMutualFriends() public method

This method will not return Friendship models It will return the 'friends' models. ex: App\User
public getMutualFriends ( Model $other, integer $perPage ) : Illuminate\Database\Eloquent\Collection
$other Illuminate\Database\Eloquent\Model
$perPage integer Number
return Illuminate\Database\Eloquent\Collection

getMutualFriendsCount() public method

Get the number of friends
public getMutualFriendsCount ( $other ) : integer
return integer

getOrPaginate() protected method

protected getOrPaginate ( $builder, $perPage )

getPendingFriendships() public method

public getPendingFriendships ( string $groupSlug = '' ) : Illuminate\Database\Eloquent\Collection
$groupSlug string
return Illuminate\Database\Eloquent\Collection

groupFriend() public method

public groupFriend ( Model $friend, $groupSlug ) : boolean
$friend Illuminate\Database\Eloquent\Model
$groupSlug
return boolean

groups() public method

public groups ( ) : Illuminate\Database\Eloquent\Relations\MorphMany
return Illuminate\Database\Eloquent\Relations\MorphMany

hasBlocked() public method

public hasBlocked ( Model $recipient ) : boolean
$recipient Illuminate\Database\Eloquent\Model
return boolean

hasFriendRequestFrom() public method

public hasFriendRequestFrom ( Model $recipient ) : boolean
$recipient Illuminate\Database\Eloquent\Model
return boolean

hasSentFriendRequestTo() public method

public hasSentFriendRequestTo ( Model $recipient ) : boolean
$recipient Illuminate\Database\Eloquent\Model
return boolean

isBlockedBy() public method

public isBlockedBy ( Model $recipient ) : boolean
$recipient Illuminate\Database\Eloquent\Model
return boolean

isFriendWith() public method

public isFriendWith ( Model $recipient ) : boolean
$recipient Illuminate\Database\Eloquent\Model
return boolean

unblockFriend() public method

public unblockFriend ( Model $recipient ) : mixed
$recipient Illuminate\Database\Eloquent\Model
return mixed

unfriend() public method

public unfriend ( Model $recipient ) : boolean
$recipient Illuminate\Database\Eloquent\Model
return boolean

ungroupFriend() public method

public ungroupFriend ( Model $friend, $groupSlug = '' ) : boolean
$friend Illuminate\Database\Eloquent\Model
$groupSlug
return boolean