add to interview url
This commit is contained in:
@ -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'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
31
frontend/modules/api/models/AddToInterviewForm.php
Normal file
31
frontend/modules/api/models/AddToInterviewForm.php
Normal 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'],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user