opensupports/server/controllers/article/get-all.php

26 lines
662 B
PHP
Raw Normal View History

2016-11-23 02:27:05 +01:00
<?php
use Respect\Validation\Validator as DataValidator;
DataValidator::with('CustomValidations', true);
class GetAllArticlesController extends Controller {
const PATH = '/get-all';
const METHOD = 'POST';
2016-11-23 02:27:05 +01:00
public function validations() {
return [
'permission' => (Controller::isUserSystemEnabled()) ? 'user' : 'any',
2016-11-23 02:27:05 +01:00
'requestData' => []
];
}
public function handler() {
$topics = Topic::getAll();
$topicsArray = [];
foreach($topics as $topic) {
$topicsArray[] = $topic->toArray();
}
Response::respondSuccess($topicsArray);
}
}