public static function no_auto($user) { if ($user == 'moving') { $jumlah = LocationMovingTr::count(); if ($jumlah > 0) { $all = LocationMovingTr::select('no')->orderBy('no', 'desc')->first(); $no = $all->no; $hasil = substr($no, 2, 9); $kode = $hasil . ($jumlah + 1); } else { $hasil = 00; $kode = $hasil . ($jumlah + 1); } $pre = 'MB'; } // return $hasil; return $pre . $kode; }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function move_update(Request $request, $id) { //update $locations = LocationMovingTr::find($id); $locations->code = Input::get('code'); $locations->name = Input::get('name'); $locations->desc = Input::get('desc'); $locations->save(); Session::flash('message', 'You have successfully updated warehouse'); return Redirect::to('warehouse'); }
public function readLocationMoving(Request $request) { $id = Input::get('term'); $results = LocationMovingTr::where('no', 'LIKE', '%' . $id . '%')->get(); return Response::json($results); }