'array', 'last_online_at' => 'datetime', ]; } public function scopeOwned(Builder $query, string $ownerRef): Builder { return $query->where('owner_ref', $ownerRef); } public function location(): BelongsTo { return $this->belongsTo(PosLocation::class, 'location_id'); } public function isOnline(int $staleMinutes = 10): bool { return $this->status === self::STATUS_ONLINE && $this->last_online_at && $this->last_online_at->gte(now()->subMinutes($staleMinutes)); } public function typeLabel(): string { return (string) (config('pos.device_types.'.$this->type) ?? $this->type); } public function usesToken(): bool { return in_array($this->type, config('pos.device_token_types', []), true); } }