Add first message date to domain echoarea list
This commit is contained in:
@@ -94,7 +94,7 @@ class Domain extends Model
|
||||
->whenRaw("datetime >= '?'",$dt->subMonth()->format('Y-m-d'))->thenRaw("'month'")
|
||||
->elseRaw("'all'");
|
||||
|
||||
return Echoarea::select(['echoareas.id','name','description','active',DB::raw('count(echomails.id) AS count'),DB::raw('max(datetime) as last_message')])
|
||||
return Echoarea::select(['echoareas.id','name','description','active',DB::raw('count(echomails.id) AS count'),DB::raw('min(datetime) as first_message'),DB::raw('max(datetime) as last_message')])
|
||||
->selectRaw($case->toRaw().' AS stats')
|
||||
->join('echomails',['echomails.echoarea_id'=>'echoareas.id'],NULL,NULL,'left outer')
|
||||
->where('domain_id',$this->id)
|
||||
|
@@ -46,7 +46,8 @@ class Echoarea extends Model
|
||||
private const CACHE_TIME = 3600;
|
||||
|
||||
protected $casts = [
|
||||
'last_message' => 'datetime:Y-m-d H:i:s'
|
||||
'first_message' => 'datetime:Y-m-d H:i:s',
|
||||
'last_message' => 'datetime:Y-m-d H:i:s',
|
||||
];
|
||||
|
||||
/* RELATIONS */
|
||||
|
Reference in New Issue
Block a user