yii-rest

Yii2 - Return Response during beforeAction

喜欢而已 提交于 2021-01-27 14:00:33
问题 I am building a test API. I have created a Controller Page which extends from yii\rest\Controller. Actions needs to send a response. To access actions in this controller, a service_id value needs to be posted. If present I need to evaluate if that service_id exists, if it is active and belongs to the user logged in. If validation fails, I need to send a response. I am trying to do it using beforeAction(), but the problem is that return data is used to validate if action should continue or not