/** * Store a newly created resource in storage. * * @return Response */ public function store() { // $data = Input::All(); $data['tanggal_sk'] = formatDate($data['tanggal_sk']); $data['tanggal_mulai'] = formatDate($data['tanggal_mulai']); $data['tanggal_selesai'] = formatDate($data['tanggal_selesai']); $riwayat = new RiwayatJabatan($data); if ($riwayat->save()) { return Response::json(array('success' => true)); } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate($id) { $model = new RiwayatJabatan(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['RiwayatJabatan'])) { $model->attributes = $_POST['RiwayatJabatan']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id_riwayat_jabatan)); } } $this->render('create', array('model' => $model, 'id' => $id)); }