On domain list, also include echoareas without messages.
This commit is contained in:
parent
c59f8ee0ed
commit
df541984ab
@ -123,14 +123,15 @@ class Domain extends Model
|
|||||||
->elseRaw("'all'");
|
->elseRaw("'all'");
|
||||||
|
|
||||||
return Echoarea::cacheFor(self::CACHE_TIME)
|
return Echoarea::cacheFor(self::CACHE_TIME)
|
||||||
->select(['echoareas.id','name','description','active',DB::raw('count(echoareas.id) AS count'),DB::raw('max(datetime) as last_message')])
|
->select(['echoareas.id','name','description','active',DB::raw('count(echomails.id) AS count'),DB::raw('max(datetime) as last_message')])
|
||||||
->selectRaw($case->toRaw().' AS stats')
|
->selectRaw($case->toRaw().' AS stats')
|
||||||
->join('echomails',['echomails.echoarea_id'=>'echoareas.id'])
|
->join('echomails',['echomails.echoarea_id'=>'echoareas.id'],NULL,NULL,'left outer')
|
||||||
->where('domain_id',$this->id)
|
->where('domain_id',$this->id)
|
||||||
->groupBy('echoareas.id')
|
->groupBy('echoareas.id')
|
||||||
->groupBy('echoareas.name')
|
->groupBy('echoareas.name')
|
||||||
->groupBy('stats')
|
->groupBy('stats')
|
||||||
->orderBy('echoareas.name')
|
->orderBy('echoareas.name')
|
||||||
|
->orderBy('last_message','DESC')
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user