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/www/vendor/overtrue/laravel-favorite/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/www/vendor/overtrue/laravel-favorite/src/Traits/Favoriteable.php |
<?php
namespace Overtrue\LaravelFavorite\Traits;
use Illuminate\Database\Eloquent\Model;
/**
* @property \Illuminate\Database\Eloquent\Collection $favoriters
* @property \Illuminate\Database\Eloquent\Collection $favorites
*/
trait Favoriteable
{
/**
* @deprecated renamed to `hasBeenFavoritedBy`, will be removed at 5.0
*/
public function isFavoritedBy(Model $user): bool
{
return $this->hasBeenFavoritedBy($user);
}
public function hasFavoriter(Model $user): bool
{
return $this->hasBeenFavoritedBy($user);
}
public function hasBeenFavoritedBy(Model $user): bool
{
if (! \is_a($user, config('auth.providers.users.model'))) {
return false;
}
if ($this->relationLoaded('favoriters')) {
return $this->favoriters->contains($user);
}
return ($this->relationLoaded('favorites') ? $this->favorites : $this->favorites())
->where(\config('favorite.user_foreign_key'), $user->getKey())->count() > 0;
}
public function favorites(): \Illuminate\Database\Eloquent\Relations\MorphMany
{
return $this->morphMany(config('favorite.favorite_model'), 'favoriteable');
}
public function favoriters(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
return $this->belongsToMany(
config('auth.providers.users.model'),
config('favorite.favorites_table'),
'favoriteable_id',
config('favorite.user_foreign_key')
)
->where('favoriteable_type', $this->getMorphClass());
}
}