From 967aadf21d1bb5c7e803d5402aa5eb2c487c1cfd Mon Sep 17 00:00:00 2001 From: Deon George Date: Mon, 9 Sep 2024 13:30:45 +1000 Subject: [PATCH] Add first message date to domain echoarea list --- app/Models/Domain.php | 2 +- app/Models/Echoarea.php | 3 ++- resources/views/domain/view.blade.php | 14 +++++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) 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 @@
- {!! \Illuminate\Mail\Markdown::parse($o->homepage) !!} + {!! Markdown::parse($o->homepage) !!}
@@ -43,6 +45,7 @@ Echoarea Description + First Message Last Message Area Active Day @@ -57,6 +60,7 @@ {{ $x->name }} {{ $x->description }} + {{ ($xx=$oo->min('first_message')) ? $xx->format('Y-m-d H:i') : '-' }} {{ $x->last_message ? $x->last_message->format('Y-m-d H:i') : '-' }} {{ $x->active ? 'Active' : 'Archive' }} {{ number_format($oo->where('stats','day')->pop()?->count) }} @@ -218,17 +222,17 @@ pageLength: 25, searching: true, ordering: true, - order: [[3,'asc'],[1,'asc']], + order: [[4,'asc'],[1,'asc']], conditionalPaging: { style: 'fade', speed: 500 // optional }, rowGroup: { - dataSrc: [3], + dataSrc: [4], }, columnDefs: [ { - targets: [3], + targets: [4], visible: false, }, ],