私は4つのテーブルを持っていますusers, opportunities, level_translations and levels
ユーザー
ID、名前、電子メール
商談
ID、client_name、user_id、total_price
レベル
ID、最小、最大
level_translations
ID、名前、説明、ロケール、level_id
特定のユーザーIDの現在のロケールでレベル名を取得したい..アプリケーションをローカライズするためにlaravel-translatableパッケージを使用しています
レベルを取得するには、このようなものにする必要があります
select * from levels where sum(opportunities.total_price) < levels.max and sum(opportunities.total_price) > levels.min