ghanem/friendship
最新稳定版本:1.0
Composer 安装命令:
composer require ghanem/friendship
包简介
friendship system for Laravel 5
README 文档
README
This package will allow you to add a full report system into your Laravel application.
Installation
First, pull in the package through Composer.
composer require ghanem/friendship
And then include the service provider within app/config/app.php.
'providers' => [ Ghanem\Friendship\FriendshipServiceProvider::class ];
At last you need to publish
php artisan vendor:publish --provider="Ghanem\Friendship\FriendshipServiceProvider"
and run the migration.
php artisan migrate
Setup a Model
<?php namespace App; use Ghanem\Friendship\Contracts\Friendable; use Ghanem\Friendship\Traits\Friendable as FriendableTrait; use Illuminate\Database\Eloquent\Model; class User extends Model implements Friendable { use FriendableTrait; }
Examples
Send a Friend-Request to a Model
$user->befriend($userToBeFriendsWith);
Unfriend a Model
$user->unfriend($userToBeFriendsWith);
Deny a Friend-Request from a Model
$user->denyFriendRequest($userToBeFriendsWith);
Accept a Friend-Request from a Model
$user->acceptFriendRequest($userToBeFriendsWith);
Block a Model
$user->blockFriendRequest($userToBeFriendsWith);
Unblock a Model
$user->unblockFriendRequest($userToBeFriendsWith);
Check if the Model has blocked another Model
$user->hasBlocked($userToBeFriendsWith);
Check if one Model is blocked by another Model
$user->isBlockedBy($userToBeFriendsWith);
Check if a Friendship exists between two models
$user->isFriendsWith($userToBeFriendsWith);
Get a single friendship
$user->getFriendship($userToBeFriendsWith);
Get a list of all Friendships
$user->getAllFriendships();
Get a list of pending Friendships
$user->getPendingFriendships();
Get a list of accepted Friendships
$user->getAcceptedFriendships();
Get a list of denied Friendships
$user->getDeniedFriendships();
Get a list of blocked Friendships
$user->getBlockedFriendships();
Get a list of pending Friend-Requests
$user->getFriendRequests();
统计信息
- 总下载量: 136
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 19
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-10-23