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';
|
2017-02-08 19:09:15 +01:00
|
|
|
const METHOD = 'POST';
|
2016-11-23 02:27:05 +01:00
|
|
|
|
|
|
|
public function validations() {
|
|
|
|
return [
|
2017-01-16 20:07:53 +01:00
|
|
|
'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);
|
|
|
|
}
|
|
|
|
}
|