mirror of https://github.com/kcal-app/kcal.git
				
				
				
			
							parent
							
								
									2a05ebc3c8
								
							
						
					
					
						commit
						b955eb53b8
					
				|  | @ -52,9 +52,9 @@ trait Ingredient | ||||||
|     public static function getTagTotals(string $locale = null): DatabaseCollection { |     public static function getTagTotals(string $locale = null): DatabaseCollection { | ||||||
|         $locale = $locale ?? app()->getLocale(); |         $locale = $locale ?? app()->getLocale(); | ||||||
|         return Tag::query()->join('taggables', 'taggables.tag_id', '=', 'id') |         return Tag::query()->join('taggables', 'taggables.tag_id', '=', 'id') | ||||||
|             ->select(['id', 'name', DB::raw('count(*) as total')]) |             ->select(['name', DB::raw('count(*) as total')]) | ||||||
|             ->where('taggables.taggable_type', '=', static::class) |             ->where('taggables.taggable_type', '=', static::class) | ||||||
|             ->groupBy('id') |             ->groupBy('name') | ||||||
|             ->orderBy("name->{$locale}") |             ->orderBy("name->{$locale}") | ||||||
|             ->get(); |             ->get(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue