1. Go to this page and download the library: Download laravel-interaction/clap 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/ */
laravel-interaction / clap example snippets
use Illuminate\Database\Eloquent\Model;
use LaravelInteraction\Clap\Concerns\Clapper;
class User extends Model
{
use Clapper;
}
use Illuminate\Database\Eloquent\Model;
use LaravelInteraction\Clap\Concerns\Clappable;
class Channel extends Model
{
use Clappable;
}
use LaravelInteraction\Clap\Tests\Models\Channel;
/** @var \LaravelInteraction\Clap\Tests\Models\User $user */
/** @var \LaravelInteraction\Clap\Tests\Models\Channel $channel */
// Clap to Ratable
$user->clap($channel);
// clap is only allowed to be called once
$user->clapOnce($channel);
$user->unclap($channel);
// Compare Ratable
$user->hasClapped($channel);
$user->hasNotClapped($channel);
// Get clapped info
$user->clapperApplause()->count();
// with type
$user->clapperApplause()->withType(Channel::class)->count();
// get clapped channels
Channel::query()->whereClappedBy($user)->get();
// get channels doesnt clapped by user
Channel::query()->whereNotClappedBy($user)->get();