1. Go to this page and download the library: Download oroalej/laravel-likeable library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
oroalej / laravel-likeable example snippets
// Liker
use Illuminate\Foundation\Auth\User as Authenticatable;
use Oroalej\Likeable\Models\Traits\Liker;
Class User extends Authenticatable
{
use Liker;
}
// Likeable
use Illuminate\Database\Eloquent\Model;
use Oroalej\Likeable\Models\Traits\Likeable;
Class Post extends Model
{
use Likeable;
}
// Liker
$user = User::find(1);
$user->getLikeCountByType(Post::class);
$user->getTotalLikeCount();
// Likeable
// To avoid the n+1 issue, please make sure to
bash
php artisan migrate
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.