Change our mail packet name to be the youngest ID in the packet, not the youngest date
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Classes\File;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -36,13 +37,13 @@ final class Mail extends Send
|
||||
return $this->f->messages->pluck('id');
|
||||
|
||||
case 'name':
|
||||
return sprintf('%08x',timew($this->youngest()));
|
||||
return sprintf('%08x',$this->youngest_id());
|
||||
|
||||
case 'nameas':
|
||||
return sprintf('%s.pkt',$this->name);
|
||||
|
||||
case 'mtime':
|
||||
return $this->youngest()->timestamp;
|
||||
return $this->youngest_date()->timestamp;
|
||||
|
||||
case 'type':
|
||||
return ($this->ftype&0xff00)>>8;
|
||||
@@ -114,8 +115,18 @@ final class Mail extends Send
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
private function youngest(): Carbon
|
||||
private function youngest(): array
|
||||
{
|
||||
return $this->f->messages->pluck('date')->sort()->last();
|
||||
return $this->f->messages->sortBy(fn($item)=>Arr::get($item,'datetime'))->first();
|
||||
}
|
||||
|
||||
private function youngest_id(): int
|
||||
{
|
||||
return Arr::get($this->youngest(),'id',0);
|
||||
}
|
||||
|
||||
private function youngest_date(): Carbon
|
||||
{
|
||||
return Arr::get($this->youngest(),'datetime',Carbon::now());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user