mirror of
https://github.com/elyby/accounts.git
synced 2024-11-20 04:03:12 +05:30
40 lines
810 B
PHP
40 lines
810 B
PHP
<?php
|
|
namespace api\controllers;
|
|
|
|
use api\models\FeedbackForm;
|
|
use Yii;
|
|
use yii\helpers\ArrayHelper;
|
|
|
|
class FeedbackController extends Controller {
|
|
|
|
public function behaviors() {
|
|
return ArrayHelper::merge(parent::behaviors(), [
|
|
'authenticator' => [
|
|
'except' => ['index'],
|
|
],
|
|
]);
|
|
}
|
|
|
|
public function verbs() {
|
|
return [
|
|
'index' => ['POST'],
|
|
];
|
|
}
|
|
|
|
public function actionIndex() {
|
|
$model = new FeedbackForm();
|
|
$model->load(Yii::$app->request->post());
|
|
if (!$model->sendMessage()) {
|
|
return [
|
|
'success' => false,
|
|
'errors' => $model->getFirstErrors(),
|
|
];
|
|
}
|
|
|
|
return [
|
|
'success' => true,
|
|
];
|
|
}
|
|
|
|
}
|