controllers/DefaultController.php
public function actionTaskcreate($projectid = null, $parenttask = null)
    {
        if (!isset($projectid)) {
            $projectid = $this->getRequestParam('projectid');
        }


        $model = new Task();

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(Url::toRoute(['taskview', 'projectid' => $projectid, 'id' => $model->id,]));
        } else {
            $model->projectID = $projectid;
            $model->parenttask = isset($parenttask) ? $parenttask : 0;
            return $this->render('taskcreate', [
                'model' => $model,]);
        }
    }
public function actionTaskcreate($projectid = null, $parenttask = null)
    {
        if (!isset($projectid)) {
            $projectid = $this->getRequestParam('projectid');
        }


        $model = new Task();

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(Url::toRoute(['taskview', 'projectid' => $projectid, 'id' => $model->id,]));
        } else {
            $model->projectID = $projectid;
            $model->parenttask = isset($parenttask) ? $parenttask : 0;
            return $this->render('taskcreate', [
                'model' => $model,]);
        }
    }
public function actionTaskcreate ( $ projectid = null , $ parenttask = null ) { if ( ! isset ( $ projectid ) ) { $ projectid = $ this -> getRequestParam ( 'projectid' ) ; } $ model = new Task ( ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { return $ this -> redirect ( Url :: toRoute ( [ 'taskview' , 'projectid' => $ projectid , 'id' => $ model -> id , ] ) ) ; } else { $ model -> projectID = $ projectid ; $ model -> parenttask = isset ( $ parenttask ) ? $ parenttask : 0 ; return $ this -> render ( 'taskcreate' , [ 'model' => $ model , ] ) ; } }
Creates a new Tasks model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed
Creates a new Tasks model . If creation is successful the browser will be redirected to the view page .