The global
keyword can only be use to declare global scope for a variable. You cannot simultaneously use an operator on that variable in the same statement.
So, try this instead:
global $companies;
$companies = DB::table('homes')->select('Company')->distinct()->get(array());