opensupports/server/controllers/article/delete.php

26 lines
700 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 DeleteArticleController extends Controller {
const PATH = '/delete';
public function validations() {
return [
'permission' => 'staff_2',
'requestData' => [
'articleId' => [
'validation' => DataValidator::dataStoreId('article'),
'error' => ERRORS::INVALID_TOPIC
]
]
];
}
public function handler() {
$article = Article::getDataStore(Controller::request('articleId'));
$article->delete();
Response::respondSuccess();
}
}