<?php
namespace SHServ\Middleware;
class ControlScripts {
protected $devices_model;
protected function add_event_handler(String $event_name, callable $callback) {
events() -> handler("app:{$event_name}", function(Array $params) use ($callback) {
$callback($params["device"], $params["data"]);
});
}
protected function devices() {
if(!$this -> devices_model) {
$this -> devices_model = new \SHServ\Models\Devices();
}
return $this -> devices_model;
}
}