Implemented Dynamic Items for data to be sent to polled systems based on data in db, like stats/nodelists
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Calculate CCITT-CRC16 checksum
|
||||
*/
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
use App\Models\{Setup,Zone};
|
||||
|
||||
/**
|
||||
* Calculate CCITT-CRC16 checksum
|
||||
*/
|
||||
if (! function_exists('crc16')) {
|
||||
function crc16($data): int
|
||||
{
|
||||
@@ -80,6 +81,22 @@ if (! function_exists('hexstr')) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return our addresses.
|
||||
* If zone provided, limit the list to those within the zone
|
||||
*
|
||||
* @param Zone|NULL $zo
|
||||
* @return Collection
|
||||
*/
|
||||
function our_address(Zone $zo=NULL): Collection
|
||||
{
|
||||
$our = Setup::findOrFail(config('app.id'))->system->addresses;
|
||||
|
||||
return $zo
|
||||
? $our->filter(function($item) use ($zo) { return $item->zone_id === $zo->id; })
|
||||
: $our;
|
||||
}
|
||||
|
||||
if (! function_exists('timew')) {
|
||||
/**
|
||||
* Convert a time into an 32 bit value. This is primarily used to create 8 character hex filenames that
|
||||
|
Reference in New Issue
Block a user