/** * Creates a new Agenda model. * If creation is successful, the browser will be redirected to the 'view' page. * * @return mixed */ public function actionCreate() { $model = new Agenda(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->agendaID]); } else { return $this->render('create', ['model' => $model]); } }
public function saveException(array $data = array(), array $bookbuffer = array(), array $slotnum = array()) { $this->type = 'temp'; Agenda::save(true); $agendaID = Yii::$app->db->getLastInsertID(); for ($index = 0; $index < sizeof($data); $index++) { $slot = new Slot(); $slot->saveSlot($agendaID, $data[$index], 'temp', $slotnum[$index], $bookbuffer[$index]); } return $agendaID; }
/** * Store a newly created resource in storage. * * @return Response */ public function store(AgendaRequest $request) { // $input = $request->all(); $input['tgl_mulai'] = formatDate($input['tgl_mulai']); $input['tgl_selesai'] = formatDate($input['tgl_selesai']); $input['tgl_posting'] = date('Y-m-d'); $agenda = new Agenda($input); if ($agenda->save()) { return response()->json(array('success' => TRUE)); } }