backend/controllers/CompaniesController.php
/**
     * Creates a new Companies model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
Creates a new Companies model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed
Creates a new Companies model . If creation is successful the browser will be redirected to the ' view ' page . @return mixed
public function actionCreate()
    {
        if(Yii::$app->user->can('create-branch'))
        {
            $model = new Companies();
            if ($model->load(Yii::$app->request->post())) {
                $model->company_created_date = date("Y-m-d h:m:s");
                $model->save();
                return $this->redirect(['view', 'id' => $model->company_id]);
            } else {
                return $this->renderAjax('create', [
                    'model' => $model,
                ]);
            }
        }else{
            throw new ForbiddenHttpException;
        }
    }
public function actionCreate ( ) { if ( Yii :: $ app -> user -> can ( 'create-branch' ) ) { $ model = new Companies ( ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { $ model -> company_created_date = date ( " Y-m-d h:m:s " ) ; $ model -> save ( ) ; return $ this -> redirect ( [ 'view' , 'id' => $ model -> company_id ] ) ; } else { return $ this -> renderAjax ( 'create' , [ 'model' => $ model , ] ) ; } } else { throw new ForbiddenHttpException ; } }
Creates a new Companies model.
Creates a new Companies model .