public function store() { $lokasi = new LokasiKerja(); $lokasi->nama = Input::get('nama'); $lokasi->save(); Session::flash('success', 'Data telah disimpan'); return Redirect::to('/' . Auth::user()->role . '/lokasikerja'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { // membuat object baru dari LokasiKerja() dengan input lokasi_kerja $lokasi_kerja = new LokasiKerja(); $lokasi_kerja->lokasi_kerja = Input::get('lokasi_kerja'); // bila proses memasukan data berhasil maka akan mengirimkan response dalam bentuk json if ($lokasi_kerja->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() { $model = new LokasiKerja(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['LokasiKerja'])) { $model->attributes = $_POST['LokasiKerja']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id_lokasi_kerja)); } } $this->render('create', array('model' => $model)); }