sebastian-kennedy / laravel-like
User like features for laravel application.
v1.0.0
2020-06-07 03:25 UTC
Requires
- php: ^7.3
- laravel/framework: ^6.0|^7.0
Requires (Dev)
- brainmaestro/composer-git-hooks: ^2.8
- friendsofphp/php-cs-fixer: ^2.16
- laravel/framework: ^6.0|^7.0
- mockery/mockery: ^1.4
- orchestra/testbench: ^5.3
- phpunit/phpunit: ^9.2
This package is auto-updated.
Last update: 2024-12-18 12:31:13 UTC
README
User like feature for laravel application.
References
- https://github.com/overtrue/laravel-like
- https://github.com/overtrue/laravel-follow
- https://github.com/hypefactors/laravel-follow
Requires
- PHP >= 7.3
- Laravel >= ^6.0
Installing
$ composer require sebastian-kennedy/laravel-like -vvv
Configuration
$ php artisan vendor:publish --provider="SebastianKennedy\\LaravelLike\\LikeServiceProvider" --tag=config
Migrations
$ php artisan vendor:publish --provider="SebastianKennedy\\LaravelLike\\LikeServiceProvider" --tag=migrations
Usage
BeLikedBehavior.php
<?php namespace SebastianKennedy\LaravelLike\Tests\Models; use Illuminate\Database\Eloquent\Model; use SebastianKennedy\LaravelLike\Behaviors\CanBeLikedBehavior; class Book extends Model { use CanBeLikedBehavior; protected $fillable = ['title']; }
ToLikeBehavior.php
<?php namespace SebastianKennedy\LaravelLike\Tests\Models; use Illuminate\Database\Eloquent\Model; use SebastianKennedy\LaravelLike\Behaviors\CanLikeBehavior; class User extends Model { use CanLikeBehavior; protected $fillable = ['name']; }
API
<?php $user = User::first(); $book = Book::first(); $user-like($book); $user->unlike($book); $user->toggleLike($book); $user->hasLiked($book); $user->likes(); $book->isLikedBy($user); $book->likes(); $book->likers();
Contributing
You can contribute in one of three ways:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- Contribute new features or update the wiki.
The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-12 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.
License
MIT