2017-01-16 16:07:53 -03:00

25 lines
635 B
PHP

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