Вопрос

I'm getting a fatal error that seems to makes no sense to me on the global $companies variable... Any thoughts?

Error:

Symfony \ Component \ Debug \ Exception \ FatalErrorException
syntax error, unexpected '=', expecting ',' or ';'

Code:

public function getCreate(){
            $view = View::make('account.create');
            global $companies = DB::table('homes')->select('Company')->distinct()->get(array());
            return $view->with('companies', $companies)->with('home_names', $home_names);
        }
Это было полезно?

Решение

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());
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top