Laravel:试图获得非对象的属性

时间:2015-03-26 03:00:08

标签: mysql laravel laravel-4 eloquent laravel-5

我试图在我的视图中找到某个列,但是我有一个错误说

“试图获取非对象属性”

你能帮帮我们吗?

这是我的控制器

    $subject = Subject1::where('teacher_id', '=' , Auth::user()->id)->lists('section_name');

    return View::make('teacher.view_sectionassigned')
        ->with('subject', $subject);

谢谢!!

1 个答案:

答案 0 :(得分:0)

尝试遵循一个

$subject = Subject1::where('teacher_id', '=' , Auth::user()->id)->get(array('section_name'));

return View::make('teacher.view_sectionassigned')
    ->with('subject', $subject);