Getting models that has been translated generally or in specific locale.
1$posts = Post::translated()->get(); // General2$posts = Post::translated('en')->get(); // Localized3 4// Returns Illuminate\Database\Eloquent\Collection
Getting models that has not been translated generally or in specific locale.
1$posts = Post::notTranslated()->get(); // General2$posts = Post::notTranslated('en')->get(); // Localized3 4// Returns Illuminate\Database\Eloquent\Collection
Sorting the translated records depends on locale.
1$posts = Post::translatedSorting('en', 'title', 'asc')->get();2 3// Returns Illuminate\Database\Eloquent\Collection
Getting models that has ben translated with whereTranslation / orWhereTranslation conditions.
1$posts = Post::translated('en')2 ->whereTranslation('column1', 'value')3 ->orWhereTranslation('column2', 'value', 'en')4 ->get();5 6// Returns Illuminate\Database\Eloquent\Collection
Getting models that has ben translated with whereTranslationLike / orWhereTranslationLike conditions.
1$posts = Post::translated('en')2 ->whereTranslationLike('column1', '%' . $value . '%')3 ->orWhereTranslationLike('column2', '%' . $value . '%', 'en')4 ->get();5 6// Returns Illuminate\Database\Eloquent\Collection