Move determination of system packet to System::class

This commit is contained in:
2024-04-21 20:40:19 +10:00
parent 8bf58f3daa
commit 1c270025cf
2 changed files with 45 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use App\Classes\FTN\Packet;
use App\Jobs\AddressPoll;
class System extends Model
@@ -249,6 +250,17 @@ class System extends Model
});
}
/**
* Return the packet that this system uses
*
* @return Packet
*/
public function packet(): Packet
{
return new (collect(Packet::PACKET_TYPES)
->get($this->pkt_type ?: config('fido.packet_default')));
}
public function poll(): ?Job
{
return Job::where('queue',AddressPoll::QUEUE)