2016-10-14 01:29:36 +02:00
|
|
|
<?php
|
|
|
|
use Respect\Validation\Validator as DataValidator;
|
|
|
|
DataValidator::with('CustomValidations', true);
|
|
|
|
|
2017-04-17 04:59:11 +02:00
|
|
|
/**
|
|
|
|
* @api {post} /ticket/delete-custom-response Delete a custom response.
|
|
|
|
*
|
|
|
|
* @apiName Delete custom response
|
|
|
|
*
|
|
|
|
* @apiGroup Ticket
|
|
|
|
*
|
|
|
|
* @apiDescription This path delete a custom response.
|
|
|
|
*
|
|
|
|
* @apiPermission user
|
|
|
|
*
|
2017-04-21 08:09:24 +02:00
|
|
|
* @apiParam {Number} id Id of the custom response to delete.
|
2017-04-17 04:59:11 +02:00
|
|
|
*
|
2017-04-21 08:09:24 +02:00
|
|
|
* @apiUse NO_PERMISSION
|
|
|
|
* @apiUse NO_PERMISSION
|
|
|
|
*
|
|
|
|
* @apiSuccess {Object} data Empty object
|
2017-04-17 04:59:11 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-10-14 01:29:36 +02:00
|
|
|
class DeleteCustomResponseController extends Controller {
|
|
|
|
const PATH = '/delete-custom-response';
|
2017-02-08 19:09:15 +01:00
|
|
|
const METHOD = 'POST';
|
2016-10-14 01:29:36 +02:00
|
|
|
|
|
|
|
public function validations() {
|
|
|
|
return [
|
|
|
|
'permission' => 'staff_2',
|
|
|
|
'requestData' => [
|
|
|
|
'id' => [
|
|
|
|
'validation' => DataValidator::dataStoreId('customresponse'),
|
|
|
|
'error' => ERRORS::INVALID_NAME
|
|
|
|
]
|
|
|
|
]
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function handler() {
|
|
|
|
$customResponse = CustomResponse::getDataStore(Controller::request('id'));
|
2016-11-23 02:27:05 +01:00
|
|
|
$customResponse->delete();
|
2016-10-14 01:29:36 +02:00
|
|
|
|
2016-12-29 01:55:00 +01:00
|
|
|
Log::createLog('DELETE_CUSTOM_RESPONSE', null);
|
|
|
|
|
2016-10-14 01:29:36 +02:00
|
|
|
Response::respondSuccess();
|
|
|
|
}
|
|
|
|
}
|