where('categories_id', $record->id)->count();