Fix message path ordering

This commit is contained in:
Deon George 2021-08-30 00:44:20 +10:00
parent 01d54794a8
commit 97384ce3a0

View File

@ -3,6 +3,7 @@
namespace App\Models;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Jenssegers\Mongodb\Eloquent\Model;
use Jenssegers\Mongodb\Eloquent\SoftDeletes;
@ -37,7 +38,10 @@ class Echomail extends Model implements Packet
public function getPathAttribute($value): Collection
{
return Address::whereIn('id',$value)->get()->pluck('ftn3d');
return Address::whereIn('id',$value)
->orderBy(DB::raw(sprintf("position (id::text in '(%s)')",join(',',$value))))
->get()
->pluck('ftn3d');
}
public function getSeenByAttribute($value): Collection