26 lines
700 B
PHP
26 lines
700 B
PHP
|
<?php
|
||
|
use Respect\Validation\Validator as DataValidator;
|
||
|
DataValidator::with('CustomValidations', true);
|
||
|
|
||
|
class DeleteTopicController extends Controller {
|
||
|
const PATH = '/delete-topic';
|
||
|
|
||
|
public function validations() {
|
||
|
return [
|
||
|
'permission' => 'staff_2',
|
||
|
'requestData' => [
|
||
|
'topicId' => [
|
||
|
'validation' => DataValidator::dataStoreId('topic'),
|
||
|
'error' => ERRORS::INVALID_TOPIC
|
||
|
]
|
||
|
]
|
||
|
];
|
||
|
}
|
||
|
|
||
|
public function handler() {
|
||
|
$topic = Topic::getDataStore(Controller::request('topicId'));
|
||
|
$topic->delete();
|
||
|
|
||
|
Response::respondSuccess();
|
||
|
}
|
||
|
}
|