/** * Executes the job. * * @return bool */ public function handle() { $this->status->user_id = auth()->id(); $this->status->name = $this->request->input('name'); $this->status->color = $this->request->input('color'); return $this->status->save(); }
/** * Creates a new Status model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Status(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Creates a new Status model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Status(); if ($model->load(Yii::$app->request->post())) { /* $model->created_by = Yii::$app->user->getId(); $model->created_at = time(); $model->updated_at = time();*/ if ($model->save()) { return $this->redirect(['view', 'id' => $model->id]); } } return $this->render('create', ['model' => $model]); }
/** * Creates a new Status model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Status(); if ($model->load(Yii::$app->request->post())) { // $model->created_at = time(); <- to dela zdaj timestamp behavior // $model->updated_at = time(); // $model->created_by = Yii::$app->user->getId(); <- to dela zdaj bleameble behavior if ($model->save()) { // return $this->redirect(['view', 'id' => $model->id]); return $this->redirect(['index']); } } return $this->render('create', ['model' => $model]); }
/** * Execute the job. * * @return bool */ public function handle() { $this->status->name = $this->request->input('name', $this->status->name); $this->status->color = $this->request->input('color', $this->status->color); return $this->status->save(); }