diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 661dfe4..6c368b9 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -11,7 +11,8 @@ use Illuminate\Support\Facades\Gate; use App\Classes\File; use App\Classes\FTN\Packet; use App\Http\Requests\SetupRequest; -use App\Models\{Address,Domain,Echomail,Netmail,Setup}; +use App\Models\File as FileModel; +use App\Models\{Address,Domain,Echomail,Netmail,Setup,System}; class HomeController extends Controller { @@ -20,6 +21,27 @@ class HomeController extends Controller return redirect(Auth::check() ? 'dashboard' : 'about'); } + public function file_contents(System $o,string $date) + { + $f = FileModel::select('files.*') + ->distinct() + ->leftJoin('file_seenby',['file_seenby.file_id'=>'files.id']) + ->where(function($query) use ($o,$date) { + return $query + ->where('created_at',$date) + ->whereIn('fftn_id',$o->addresses->pluck('id')); + }) + ->Orwhere(function($query) use ($o,$date) { + return $query + ->where('sent_at',$date) + ->whereIn('address_id',$o->addresses->pluck('id')); + }) + ->get(); + + return view('file') + ->with('f',$f); + } + public function network(Domain $o) { if (! $o->public && ! Gate::check('admin',$o)) @@ -31,12 +53,12 @@ class HomeController extends Controller ->with('o',$o); } - public function packet_contents(string $packet) + public function packet_contents(System $o,string $packet) { $nm = Netmail::select('netmails.*') ->distinct() ->leftJoin('netmail_path',['netmail_path.netmail_id'=>'netmails.id']) - ->where(function($query) use ($packet) { + ->where(function($query) use ($o,$packet) { return $query ->where('sent_pkt',$packet) ->orWhere('netmail_path.recv_pkt',$packet); @@ -47,11 +69,17 @@ class HomeController extends Controller ->distinct() ->leftJoin('echomail_seenby',['echomail_seenby.echomail_id'=>'echomails.id']) ->leftJoin('echomail_path',['echomail_path.echomail_id'=>'echomails.id']) - ->where(function($query) use ($packet) { + ->where(function($query) use ($o,$packet) { return $query ->where('sent_pkt',$packet) - ->orWhere('recv_pkt',$packet); + ->whereIn('echomail_seenby.address_id',$o->addresses->pluck('id')); }) + ->orWhere(function($query) use ($o,$packet) { + return $query + ->where('recv_pkt',$packet) + ->whereIn('echomail_path.address_id',$o->addresses->pluck('id')); + }) + ->with('echoarea') ->get(); return view('packet') diff --git a/database/migrations/2023_07_19_132953_remove_recvpkt.php b/database/migrations/2023_07_19_132953_remove_recvpkt.php new file mode 100644 index 0000000..f683c68 --- /dev/null +++ b/database/migrations/2023_07_19_132953_remove_recvpkt.php @@ -0,0 +1,26 @@ +dropColumn(['recv_pkt']); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + abort(500,'Cant go back'); + } +}; diff --git a/resources/views/file.blade.php b/resources/views/file.blade.php new file mode 100644 index 0000000..a4a7d96 --- /dev/null +++ b/resources/views/file.blade.php @@ -0,0 +1,24 @@ +@if($f->count()) + + + + + + + + + + + + + + @foreach ($f as $oo) + + + + + + @endforeach + +
Files
OriginNameDate
{{ $oo->fftn->ftn }}{{ $oo->name }}{{ $oo->datetime }}
+@endif \ No newline at end of file diff --git a/resources/views/packet.blade.php b/resources/views/packet.blade.php index 2c14c24..83f3ab8 100644 --- a/resources/views/packet.blade.php +++ b/resources/views/packet.blade.php @@ -34,6 +34,7 @@ From MSGID + Echoarea Date @@ -43,6 +44,7 @@ {{ $oo->fftn->ftn }} {{ $oo->msgid }} + {{ $oo->echoarea->name }} {{ $oo->datetime }} @endforeach diff --git a/resources/views/system/addedit.blade.php b/resources/views/system/addedit.blade.php index 742d4ac..4a29aea 100644 --- a/resources/views/system/addedit.blade.php +++ b/resources/views/system/addedit.blade.php @@ -417,8 +417,10 @@
The last Netmails sent (to you): - @if(($x=\App\Models\Netmail::whereIn('sent_id',$o->addresses->pluck('id')) + @if(($x=\App\Models\Netmail::select(['sent_pkt','sent_at',DB::raw('count(*) AS count')]) + ->whereIn('sent_id',$o->addresses->pluck('id')) ->whereNotNull('sent_at') + ->groupBy(['sent_pkt','sent_at']) ->orderBy('sent_at','DESC') ->limit(10) ->get())->count()) @@ -427,17 +429,17 @@ Packet - Count Sent + Count - @foreach ($x->groupBy('sent_pkt') as $oo) + @foreach ($x as $oo) - {{ $oo->first()->sent_pkt }} - {{ $oo->count() }} - {{ $oo->first()->sent_at }} + {{ $oo->sent_pkt }} + {{ $oo->sent_at }} + {{ $oo->count }} @endforeach @@ -450,29 +452,62 @@
The last Echomails sent (to you): - @if(($x=\App\Models\Echomail::select(['echomails.id','echomail_seenby.sent_pkt','echomail_seenby.sent_at']) + @if(($x=\App\Models\Echomail::select(['sent_pkt','sent_at',DB::raw('count(*) AS count')]) ->join('echomail_seenby',['echomail_seenby.echomail_id'=>'echomails.id']) - ->whereNotNull('echomail_seenby.sent_at') + ->whereNotNull('sent_at') ->whereIn('address_id',$o->addresses->pluck('id')) + ->groupBy(['sent_pkt','sent_at']) ->orderBy('sent_at','DESC') - ->orderBy('sent_pkt') ->limit(10) ->get())->count()) - + - @foreach ($x->groupBy('sent_pkt') as $oo) + @foreach ($x as $oo) - - - + + + + + @endforeach + +
PacketCount SentCount
{{ $oo->first()->sent_pkt }}{{ $oo->count() }}{{ $oo->first()->sent_at }}{{ $oo->sent_pkt }}{{ $oo->sent_at }}{{ $oo->count }}
+ @else + None + @endif +
+ +
+ The last Files sent (to you): + + @if(($x=\App\Models\File::select(['sent_at',DB::raw('count(*) AS count')]) + ->join('file_seenby',['file_seenby.file_id'=>'files.id']) + ->whereNotNull('sent_at') + ->whereIn('address_id',$o->addresses->pluck('id')) + ->groupBy(['sent_at']) + ->orderBy('sent_at','DESC') + ->limit(10) + ->get())->count()) + + + + + + + + + + @foreach ($x as $oo) + + + @endforeach @@ -487,9 +522,10 @@
The last Netmails received (you sent): - @if(($x=\App\Models\Netmail::select(['netmails.*','netmail_path.recv_pkt']) + @if(($x=\App\Models\Netmail::select(['recv_pkt','created_at',DB::raw('count(*) AS count')]) ->join('netmail_path',['netmail_path.netmail_id'=>'netmails.id']) ->whereIn('address_id',$o->addresses->pluck('id')) + ->groupBy(['recv_pkt','created_at']) ->orderBy('created_at','DESC') ->limit(10) ->get())->count()) @@ -497,17 +533,17 @@
- + - @foreach ($x->groupBy('recv_pkt') as $oo) + @foreach ($x as $oo) - - - + + + @endforeach @@ -520,29 +556,60 @@
The last Echomails received (you sent): - @if(($x=\App\Models\Echomail::select(['echomails.created_at','echomail_path.recv_pkt']) + @if(($x=\App\Models\Echomail::select(['recv_pkt','created_at',DB::raw('count(*) AS count')]) ->join('echomail_path',['echomail_path.echomail_id'=>'echomails.id']) - ->whereNotNull('echomail_path.recv_pkt') + ->whereNotNull('recv_pkt') ->whereIn('address_id',$o->addresses->pluck('id')) + ->groupBy(['recv_pkt','created_at']) ->orderBy('created_at','DESC') - ->orderBy('recv_pkt') ->limit(10) ->get())->count())
SessionCount
{{ $oo->sent_at }}{{ $oo->count }}
PacketCount ReceivedCount
{{ $oo->first()->recv_pkt }}{{ $oo->count() }}{{ $oo->first()->created_at }}{{ $oo->recv_pkt }}{{ $oo->created_at }}{{ $oo->count }}
- + - @foreach ($x->groupBy('recv_pkt') as $oo) + @foreach ($x as $oo) - - - + + + + + @endforeach + +
PacketCount ReceivedCount
{{ $oo->first()->recv_pkt }}{{ $oo->count() }}{{ $oo->first()->created_at }}{{ $oo->recv_pkt }}{{ $oo->created_at }}{{ $oo->count }}
+ @else + None + @endif +
+ +
+ The last Files received (from you): + + @if(($x=\App\Models\File::select(['created_at',DB::raw('count(*) AS count')]) + ->whereIn('fftn_id',$o->addresses->pluck('id')) + ->groupBy(['created_at']) + ->orderBy('created_at','DESC') + ->limit(10) + ->get())->count()) + + + + + + + + + + @foreach ($x as $oo) + + + @endforeach @@ -562,6 +629,7 @@ @include('widgets.modal_packet') + @include('widgets.modal_files') @include('widgets.modal_purge') @endsection diff --git a/resources/views/widgets/modal_files.blade.php b/resources/views/widgets/modal_files.blade.php new file mode 100644 index 0000000..6417566 --- /dev/null +++ b/resources/views/widgets/modal_files.blade.php @@ -0,0 +1,58 @@ + + + +@section('page-scripts') + +@append \ No newline at end of file diff --git a/resources/views/widgets/modal_packet.blade.php b/resources/views/widgets/modal_packet.blade.php index 1f49606..5e87b8b 100644 --- a/resources/views/widgets/modal_packet.blade.php +++ b/resources/views/widgets/modal_packet.blade.php @@ -1,3 +1,4 @@ +
SessionCount
{{ $oo->created_at }}{{ $oo->count }}