【发布时间】:2016-02-15 11:08:32
【问题描述】:
我正在尝试进行此查询:
SELECT DISTINCT field_1 FROM Table1
我的模特:
public function ano_semestre()
{
return Turma::distinct()->select('ano_semestre')->get()->toArray();
}
我的看法:
@foreach($professor as $key => $prof)
@foreach($prof->ano_semestre as $semestre)
{{ dd($semestre->ano_semestre) }}
@endforeach
@endforeach
我的控制器:
public function getProfessorList()
{
$professor = Professor::all();
return View::make('professor', compact('professor'));
}
我收到此错误:
Relationship 方法必须返回 Illuminate\Database\Eloquent\Relations\Relation 类型的对象
当我尝试访问时发生错误:
$prof->ano_semestre
【问题讨论】: