2018-08-29 06:15:11 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Repositories;
|
|
|
|
|
|
|
|
use App\Models\Interaction;
|
|
|
|
use App\Models\User;
|
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
2022-07-29 06:47:10 +00:00
|
|
|
class InteractionRepository extends Repository
|
2018-08-29 06:15:11 +00:00
|
|
|
{
|
2020-12-22 20:11:22 +00:00
|
|
|
/** @return Collection|array<Interaction> */
|
2018-08-29 06:15:11 +00:00
|
|
|
public function getUserFavorites(User $user): Collection
|
|
|
|
{
|
2024-01-03 17:02:18 +00:00
|
|
|
return Interaction::query()
|
2022-08-09 18:45:11 +00:00
|
|
|
->where([
|
|
|
|
'user_id' => $user->id,
|
|
|
|
'liked' => true,
|
|
|
|
])
|
2018-08-29 06:15:11 +00:00
|
|
|
->with('song')
|
|
|
|
->pluck('song');
|
|
|
|
}
|
|
|
|
}
|