2016-04-08 40 views
0

我在我的數據庫3個表:加盟DB ::原始()laravel 4

reponse[id,nomRep,#envoi_id] 
 
envoi[id,#projet_id,#quest_id] 
 
projet[id,nomProjet]

我想要做的就是使用讓我的項目的名代碼如下:

$days = Input::get('days', 7); 
 
        $range = \Carbon\Carbon::now()->subDays($days); 
 
      $chartt = DB::table('reponse') 
 
       ->where('created_at', '>=', $range) 
 
       ->groupBy('value') 
 
       
 
       ->remember(1440) 
 
       ->get([ 
 
        DB::raw('envoi_id as nomProjet')// here where i want to get the name of my project, 
 
        DB::raw('etatSatisfaction as value') 
 
        
 
       ]); 
 

 
      return $chartt;

請幫忙嗎?

+0

任何幫助pleaaase? –

回答

1

這裏是我發現它在我自己的答案,mybe有人需要它:

DB::raw(' (SELECT p.nom FROM projet p,ligneenvoi l WHERE rep.ligneenvoi_id=l.id AND l.projet_id=p.id) AS nomProjet ') ,