PK
œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Notice: ob_end_clean(): Failed to delete buffer. No buffer to delete in /home/foruwedy/public_html/57dae0/index.php on line 8
| Dir : /home/foruwedy/public_html/vendor/overtrue/laravel-like/src/Traits/ |
| Server: Linux premium227.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64 IP: 66.29.146.38 |
| Dir : /home/foruwedy/public_html/vendor/overtrue/laravel-like/src/Traits/Likeable.php |
<?php
namespace Overtrue\LaravelLike\Traits;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
trait Likeable
{
public function isLikedBy(Model $user): bool
{
if (\is_a($user, config('like.user_model') ?? config('auth.providers.users.model'))) {
if ($this->relationLoaded('likers')) {
return $this->likers->contains($user);
}
return $this->likers()->where(\config('like.user_foreign_key'), $user->getKey())->exists();
}
return false;
}
/**
* Return followers.
*/
public function likers(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
return $this->belongsToMany(
config('like.user_model') ?? config('auth.providers.users.model'),
config('like.likes_table'),
'likeable_id',
config('like.user_foreign_key')
)
->where('likeable_type', $this->getMorphClass());
}
protected function totalLikers(): Attribute
{
return Attribute::get(function () {
return $this->likers()->count() ?? 0;
});
}
}