2016-03-13 32 views
1

含糊不清有沒有人知道爲什麼以下是導致字段列中的列'id'是模糊錯誤?字段列表中的'id'使用Eloquent

$app_subj_current = \DB::table('tbl_subject') 
     ->join('tbl_application', 'tbl_subject.id', '=', 'tbl_application.app_subj_id') 
     ->where('tbl_application.id', $application) 
     ->lists('tbl_subject.subj_type', 'tbl_subject.id'); 

我已經指定了表的ID,我指的是,所以我不明白爲什麼我得到這個錯誤。

回答

2

我已經想通了,下面的解決了這個問題:

$app_subj_current = \DB::table('tbl_subject') 
    ->join('tbl_application', 'tbl_subject.id', '=', 'tbl_application.app_subj_id') 
    ->where('tbl_application.id', $application) 
    ->select('tbl_subject.subj_type as x', 'tbl_subject.id as y') 
    ->lists('x', 'y'); 
0

使用select()而不是lists()。希望它的工作。

+0

這導致ヶ輛()預計參數1爲字符串,因爲對象錯誤 – Claire

+0

使用'得到()'在年底將解決這個錯誤。 – ishadif

+0

我試過它的好奇心,它仍然導致htmlentities()期望參數1是字符串,對象給我錯誤。我有一個工作修復,雖然(見我的答案)。 – Claire

相關問題