public function run() { DB::table('rekanan')->truncate(); $rekanan = new Rekanan(); $rekanan->NamaPerusahaan = 'Bendahara Rutin DPU Kab.Kutai Timur'; $rekanan->NPWP = '00.313.178.6-724.000'; $rekanan->NamaDirektur = 'SUFRANSYAH, SE'; $rekanan->Alamat = 'Kawasan Pusat Pemerintahan Bukit Pelangi Sangatta'; $rekanan->save(); $rekanan2 = new Rekanan(); $rekanan2->NamaPerusahaan = 'PT.Wahyu Perdana'; $rekanan2->NPWP = '01.233.123.4-124.046'; $rekanan2->NamaDirektur = 'Randa Wahyu Pradhana S.Kom'; $rekanan2->Alamat = 'Jln.Delima Gg.Delima II Sangatta'; $rekanan2->save(); }
function save() { //if(Request::ajax()){ $rekanan = new Rekanan(); $rekanan->nama_rkn = Input::get('nama'); $rekanan->telp_rkn = Input::get('telp'); $rekanan->mobile_phone_rkn = Input::get('mobile'); $rekanan->email_rkn = Input::get('email'); $rekanan->is_active = 1; if ($rekanan->save()) { echo "ok"; } else { echo "error"; } //} }
/** Store a newly created resource in storage. @return Response */ public function postCreate() { // Declare the rules for the form validation $rules = array('kdrektxt' => 'required|min:3|unique:rekanans,kdrek', 'namarektxt' => 'required|min:3', 'jbayartxt' => 'required|min:3', 'prodjasatxt' => 'required|min:3'); $messages = ['kdrektxt.unique' => 'Kode Rekanan sudah ada', 'kdrektxt.min' => 'Kode Rekanan minimal 3 karakter', 'kdrektxt.required' => 'Silahkan isi Kode Rekanan', 'namarektxt.min' => 'Kode Nama Rekanan minimal 3 karakter', 'namarektxt.required' => 'Silahkan isi Kode Nama Rekanan', 'jbayartxt.min' => 'Kode Jenis Pembayaran minimal 3 karakter', 'jbayartxt.required' => 'Silahkan isi Kode Jenis Pembayaran', 'prodjasatxt.min' => 'Kode Jenis Produk/Jasa minimal 3 karakter', 'prodjasatxt.required' => 'Silahkan isi Kode Jenis Produk/Jasa']; // Validate the inputs $validator = Validator::make(Input::all(), $rules, $messages); // Check if the form validates with success if ($validator->passes()) { // Create a new blog rekanan $idkode = Input::get('kdrektxt'); // Update the blog rekanan data $this->rekanan->kdrek = Input::get('kdrektxt'); $this->rekanan->cp = Input::get('cptxt'); $this->rekanan->jabatan = Input::get('jabatantxt'); $this->rekanan->namarek = Input::get('namarektxt'); $this->rekanan->telpon1 = Input::get('telpon1txt'); $this->rekanan->alamat = Input::get('alamattxt'); $this->rekanan->hp = Input::get('hptxt'); $this->rekanan->kodepos = Input::get('kodepostxt'); $this->rekanan->email = Input::get('emailtxt'); $this->rekanan->kota = Input::get('kotatxt'); $this->rekanan->propinsi = Input::get('propinsitxt'); $this->rekanan->negara = Input::get('negaratxt'); $this->rekanan->jbayar = Input::get('jbayartxt'); $this->rekanan->bank = Input::get('banktxt'); $this->rekanan->npwp = Input::get('npwptxt'); $this->rekanan->norek = Input::get('norektxt'); $this->rekanan->telpon2 = Input::get('telpon2txt'); $this->rekanan->girocek = Input::get('girocektxt'); $this->rekanan->fax = Input::get('faxtxt'); $this->rekanan->emailgiro = Input::get('emailgirotxt'); $this->rekanan->web = Input::get('webtxt'); $this->rekanan->prodjasa = Input::get('prodjasatxt'); // Was the blog rekanan created? if ($this->rekanan->save()) { // Redirect to the new blog rekanan page $this->rekanan->kdrek = Input::get('kdrektxt'); return Redirect::to('admin/rekanans/' . $this->rekanan->kdrek . '/edit')->with('success', Lang::get('admin/rekanans/message.create.success')); } // Redirect to the blog rekanan create page return Redirect::to('admin/rekanans/create')->with('error', Lang::get('admin/rekanans/message.create.error')); } // Form validation failed return Redirect::to('admin/rekanans/create')->withInput()->withErrors($validator); }