Files
SmartHomePHP/modules/api/controllers/PanelController.php
2016-12-10 20:30:56 +02:00

46 lines
809 B
PHP

<?php
namespace app\modules\api\controllers;
use app\modules\api\components\WebSocketAPI;
use Yii;
use yii\base\NotSupportedException;
use yii\rest\Controller;
class PanelController extends Controller
{
/**
* @inheritdoc
*/
public function verbs()
{
return [
'schedule-triggers' => ['POST'],
];
}
/**
* @throws NotSupportedException
*/
public function actionIndex()
{
throw new NotSupportedException();
}
/**
* @return array|bool
*/
public function actionScheduleTriggers()
{
$api = new WebSocketAPI(Yii::$app->user->identity);
$result = $api->send([
'type' => 'schedule-triggers',
]);
return [
'success' => $result,
];
}
}