/** * Creates a new Board model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Board(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
public static function createBoard($boardName, $boardDescription = null, $cover_link = null, $user_id) { $board = new Board(); $board->title = $boardName; $board->description = $boardDescription; $board->cover_link = $cover_link; $board->user_id = $user_id; try { $board->save(); } catch (Exception $e) { } return $board; }
/** * Creates board * @return array|\yii\web\Response */ public function actionCreate() { //TODO: Check authorization. $board = new Board(); $board->scenario = Board::SCENARIO_CREATE; if ($board->load(\Yii::$app->request->post()) && $board->validate()) { if ($board->save()) { \Yii::$app->response->setStatusCode(201); // TODO: we need to return full entity, not just name return $this->actionGet($board->name); } } return $board->errors; }
public function createBoard() { if (!Auth::check()) { return redirect("/"); } if (Auth::user()->Level_id == 1) { return redirect('/managementAccount'); } if (Auth::user()->Level_id != 3) { return redirect('/'); } $dateEs = preg_split('[-]', \Input::get('date')); $Board = new Board(); $Board->name = \Input::get('name'); $Board->detail = \Input::get('detail'); /* $Board->worklimit = \Input::get('worklimit');*/ $Board->estimate_start = $dateEs[0]; $Board->estimate_end = $dateEs[1]; $Board->manager_id = Auth::user()->id; $Board->save(); $id = $Board['id']; $Manager = new Membermanagement(); $Manager->Board_id = $id; $Manager->User_id = Auth::user()->id; $Manager->save(); return redirect('/home'); }
public function actionWriteBoard($data) { if (Yii::$app->request->isAjax && !Yii::$app->user->isGuest) { Yii::$app->response->format = Response::FORMAT_JSON; $object = json_decode($data); $content = Html::encode($object->msg); if (!empty(trim($object->msg))) { $board = new Board(); $board->content = $content; $board->posted_by = Yii::$app->user->identity->id; $board->save(); if ($board->save()) { return array('boardSave' => true); } } } }