The first thing I'd do is rearchitect that database.. :D
Lots of unnecessary logic in there to parse out tags, seems like it'd be quite a bit easier to just explode(',', $Preferences); then loop through each of those to find the relevant subcategory.
In the controller you could probably do something like this:
// whatever query to get $preferences, then:
$tags = explode(',', $preferences);
foreach ($tags as $tag) {
$sub_categories[] = DB::table('descriptor')
->where('tag', $tag)
->where('rank', '<', 1000)
->select('subcategory', 'description')
->first();
}
return view('preferences', compact('sub_categories'));
in the view (preferences.blade.php):
<br><b>Preferences:</b>
@foreach ($sub_categories as $sub)
<br><b>* {{ $sub['subcategory'] }} - {{ $sub['description'] }}</b>
@endforeach
There's a little more going on there, but since you didn't include the whole thing it's a little tough to suss out the missing bits.
Ultimately though, at the end of the day -- this thing needs to be completely rewritten. This code is so old that trying to just do a migration to laravel is going to piss you off and waste more time than starting fresh and then running a script or two to migrate the existing awful data to a properly structured database. Doing otherwise is really an exercise in futility.