You must have named one of your Eloquent classes Route
and this is conflicting with Laravel's Route alias.
So you have 2 options:
1) Use namespaces
2) Rename your class
문제
I'm trying to do this
$this->current_user->company->routes
And am expecting to get a list of routes based on the currently logged in users company.
This is the error that I get
Symfony \ Component \ Debug \ Exception \ FatalErrorException
Call to undefined method Illuminate\Support\Facades\Route::newQuery()
I know I'm getting the correct info from both of the following
$this->current_user
and
$this->current_user->company
Here is my company model
<?php
class Company extends Eloquent
{
protected $guarded = array(
'id',
'created_at',
'updated_at',
);
public static function getDropDownArray()
{
$return = array();
$companies = Company::all();
foreach($companies as &$company)
{
$return[$company->id] = $company->title;
}
return $return;
}
public function routes()
{
return $this->hasMany('Route');
}
public function users()
{
return $this->hasMany('User');
}
public function locations()
{
return $this->hasMany('Location');
}
public function publications()
{
return $this->hasMany('Publication');
}
public function racks()
{
return $this->hasMany('Rack');
}
}
해결책
You must have named one of your Eloquent classes Route
and this is conflicting with Laravel's Route alias.
So you have 2 options:
1) Use namespaces
2) Rename your class