/** * Creates a new ClientUsers model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new ClientUsers(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('client-user-form', ['model' => $model]); } }
public function fbAuth() { $client_user = ClientUsers::findByEmail($this->email); if ($client_user instanceof ClientUsers) { $client_user->auth_key; } else { $client_user = new ClientUsers(); $client_user->attributes = $this->attributes; } $client_user->save(); $this->auth_key = $client_user->auth_key; return true; }
public function actionRegister() { $model = new ClientUsers(); if ($model->load(Yii::$app->request->post())) { if ($model->save()) { return ['auth_key' => $model->auth_key]; } } throw new HttpException(400, 'Your credentials are invalid ' . Helper::recursive_implode($model->errors, ',', false, false)); }