E
$array = DB::table('mineral_purposes')->select(['*', DB::raw("'purpose' as type")])
->union(DB::table('mineral_thicknesses')->select(['*', DB::raw("'thickness' as type")])->whereRaw($whereRaw)->orderBy('title'))
->get();
Сформированный запрос:
(select *, 'purpose' as type from `mineral_purposes`)
union (select *, 'thickness' as type from mineral_thicknesses where LOCATE('29', cat_ids) order by title asc)