*/ public function builder(): Builder { return Deal::query() ->select([ 'id', 'title', 'description', 'image', 'active', 'slug', 'link', 'deal_category_id', 'user_id', ]) // Select additional details ->with([ 'category:id,name', 'broker' => function ($query) { $query->select('id', 'name', 'email', 'role_type', 'role_id') ->with('type'); }, ]) // Check if the current user interacted with the deal ->tap(fn ($q) => (new Deal)->withCurrentUserInteractions($q)) ->tap(fn ($q) => (new Deal)->withLikePerDeal($q)) ->tap(fn ($q) => (new Deal)->withIsFollowedByCurrentUser($q)) ->tap(fn ($q) => (new Deal)->withRedirectionPerDeal($q)); } }