Files
dashboard-unifi/src/Models/UnifiPpsk.php
jwed 0802ef35f3 feat: password rotation, PPSK management, VLAN/AP groups
- Add password rotation: RotatePasswords console command + migration + service updates
- Add PPSK management: UnifiPpsk model, migration, SyncPpskSchedules console
- Add VLAN groups and AP groups: VlanGroupController, ApGroupController, model, migration
- Add RebootAllAps console command
- Add in_alert column to device states
- Wire new features through service provider, routes, and existing controllers/services

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 17:54:24 -04:00

31 lines
828 B
PHP

<?php
namespace Dashboard\Unifi\Models;
use Illuminate\Database\Eloquent\Model;
class UnifiPpsk extends Model
{
protected $table = 'unifi_ppsks';
protected $fillable = [
'wlan_id', 'unifi_id', 'name', 'x_passphrase', 'vlan',
'state', 'rotate_password', 'schedule',
];
protected $casts = [
'vlan' => 'integer',
'rotate_password' => 'boolean',
'schedule' => 'array',
];
/**
* Returns true if this PPSK should be active at the given day (0=Sun…6=Sat)
* and half-hour slot (0=00:00, 47=23:30).
* A null schedule means always-on.
*/
public function isScheduledOnAt(int $day, int $slot): bool
{
if (! $this->schedule) return true;
return (bool) ($this->schedule[$day * 48 + $slot] ?? true);
}
}