Advertisement
nazmiwafiy

ContactController.php

Dec 6th, 2018
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.84 KB | None | 0 0
  1. <?php
  2.  
  3. namespace backend\modules\user\controllers;
  4.  
  5. use Yii;
  6. use backend\modules\user\models\Contact;
  7. use backend\modules\user\models\SearchContact;
  8. use yii\web\Controller;
  9. use yii\web\NotFoundHttpException;
  10. use yii\filters\VerbFilter;
  11. use yii\filters\AccessControl;
  12.  
  13. // $modelUser = common\models\User::findOne(Yii::$app->user->id);
  14. // $roles = $modelUser->getRoles();
  15.  
  16. /**
  17.  * ContactController implements the CRUD actions for Contact model.
  18.  */
  19. class ContactController extends Controller
  20. {
  21.     public function actionCreate()
  22.     {
  23.         $model = new Contact();
  24.  
  25.         if ($model->load(Yii::$app->request->post()) && $model->save()) {
  26.             return $this->redirect(['view', 'id' => $model->id]);
  27.         } else {
  28.             return $this->render('create', [
  29.                 'model' => $model,
  30.             ]);
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement