mirror of
				https://github.com/opensupports/opensupports.git
				synced 2025-10-30 19:14:30 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			49 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
| <?php
 | |
| use Respect\Validation\Validator as DataValidator;
 | |
| DataValidator::with('CustomValidations', true);
 | |
| 
 | |
| /**
 | |
|  * @api {post} /ticket/delete-custom-response Delete custom response
 | |
|  * @apiVersion 4.8.0
 | |
|  *
 | |
|  * @apiName Delete custom response
 | |
|  *
 | |
|  * @apiGroup Ticket
 | |
|  *
 | |
|  * @apiDescription This path deletes a custom response.
 | |
|  *
 | |
|  * @apiPermission user
 | |
|  *
 | |
|  * @apiParam {Number} id Id of the custom response to delete.
 | |
|  *
 | |
|  * @apiUse NO_PERMISSION
 | |
|  * 
 | |
|  * @apiSuccess {Object} data Empty object
 | |
|  *
 | |
|  */
 | |
| 
 | |
| class DeleteCustomResponseController extends Controller {
 | |
|     const PATH = '/delete-custom-response';
 | |
|     const METHOD = 'POST';
 | |
| 
 | |
|     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'));
 | |
|         $customResponse->delete();
 | |
| 
 | |
|         Log::createLog('DELETE_CUSTOM_RESPONSE', null);
 | |
|         
 | |
|         Response::respondSuccess();
 | |
|     }
 | |
| } |