diff --git a/app/Models/Domain.php b/app/Models/Domain.php index 2dc2a8d..6ddfcef 100644 --- a/app/Models/Domain.php +++ b/app/Models/Domain.php @@ -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) diff --git a/app/Models/Echoarea.php b/app/Models/Echoarea.php index daf2384..08be3c4 100644 --- a/app/Models/Echoarea.php +++ b/app/Models/Echoarea.php @@ -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 */ diff --git a/resources/views/domain/view.blade.php b/resources/views/domain/view.blade.php index e7e9afa..db1fbc0 100644 --- a/resources/views/domain/view.blade.php +++ b/resources/views/domain/view.blade.php @@ -1,4 +1,6 @@ - + +@use(Illuminate\Mail\Markdown) + @extends('layouts.app') @section('htmlheader_title') {{ $o->name }} @@ -19,7 +21,7 @@