laravel with function use code example
Example: orWhere(function() pass parameter
->where(function ($query) use($locale) {
$query->where('news.language', $locale)
->orWhere('news.language', 'all');
})
->where(function ($query) use($locale) {
$query->where('news.language', $locale)
->orWhere('news.language', 'all');
})