- add favorites and reported tabs in user profile pages - add remove favorites - customers can view a deal directly from profiles section and deal modal is shown in explore page - fix formatting by pint
21 lines
491 B
PHP
21 lines
491 B
PHP
<?php
|
|
|
|
namespace App\Actions;
|
|
|
|
use App\Enums\InteractionType;
|
|
use App\Models\Deal;
|
|
use App\Models\User;
|
|
use Illuminate\Support\Collection;
|
|
|
|
final readonly class GetUserFavoritesAction
|
|
{
|
|
public function execute(User $user): Collection
|
|
{
|
|
return $user->interactedDeals()
|
|
->where('interactions.type', InteractionType::Favorite)
|
|
->tap(fn ($q) => (new Deal)->withActiveDeals($q))
|
|
->select('deals.id', 'deals.title')
|
|
->get();
|
|
}
|
|
}
|