public function store(Request $request) { $state = new state(array('state_abr' => $request->get('state_abr'), 'state' => $request->get('state'))); $state->save(); Toastr::success('State created.'); return redirect('/states'); }
public static function href($ctrl = 'home', $func = 'index', $req = array(), $sep = '&') { if ($ctrl instanceof ctrl) { $ctrl = state::save($ctrl); } elseif ($ctrl === null) { $ctrl = req::$controller; } return util::webroot() . $ctrl . '/' . $func . '?' . http_build_query($req, '', $sep); }
public function actionCreate() { $this->htmlOption = array('class' => 'icon-head head-products', 'header' => "添加州", 'button' => array(array('class' => 'scalable save', 'id' => 'form-save', 'header' => '保存'))); $states = new state(); if ($_POST['state']) { $states->attributes = $_POST['state']; if ($states->save()) { $this->redirect(array('index')); } } $this->constructScript('create'); $this->sideView = 'sidebar/create'; $this->layout = 'column2'; $this->render('create', array('model' => $states)); }