add to interview url

This commit is contained in:
andrey
2021-07-03 15:15:54 +03:00
parent 88503fd075
commit d3b75d04ad
4 changed files with 136 additions and 1 deletions

View File

@ -4,6 +4,7 @@ namespace frontend\modules\api\controllers;
use common\behaviors\GsCors;
use common\classes\Debug;
use common\models\InterviewRequest;
use frontend\modules\api\models\ProfileSearchForm;
class ProfileController extends \yii\rest\Controller
@ -39,11 +40,25 @@ class ProfileController extends \yii\rest\Controller
$searchModel = new ProfileSearchForm();
$searchModel->attributes = \Yii::$app->request->get();
if ($id){
if ($id) {
return $searchModel->byId();
}
return $searchModel->byParams();
}
public function actionAddToInterview()
{
if (\Yii::$app->request->isPost) {
$model = new InterviewRequest();
$model->attributes = \Yii::$app->request->post();
$model->created_at = time();
if ($model->save()){
return ['status' => 'success'];
}
return ['status' => 'error'];
}
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace frontend\modules\api\models;
use yii\base\Model;
/**
* Class AddToInterviewForm
* @property string $email;
* @property string $phone;
* @property integer $profile_id;
* @package frontend\modules\api\models
*/
class AddToInterviewForm extends Model
{
public $email;
public $phone;
public $profile_id;
public function rules()
{
return [
[['email', 'phone'], 'string'],
[['profile_id'], 'integer'],
[['skills'], 'checkIsArray'],
];
}
}