/** * Store a newly created resource in storage. * * @return Response */ public function store() { $input = Input::all(); $validation = Validator::make($input, Type::$rules); if ($validation->passes()) { $this->type->create($input); return Redirect::route('admin.types.index'); } return Redirect::route('admin.types.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.'); }
/** * Run the database seeds. * * @return void */ public function run() { $types = array(array('name' => 'Skin'), array('name' => 'Rank Set'), array('name' => 'MOD')); foreach ($types as $type) { Type::create($type); } }
function parametrize($event = array()) { $create = false; if (!empty($event['create']) && empty($event['errors'])) { $create = true; $entity = $event['create']; } if ($create) { switch ($entity) { case "types": App::import('Model', 'Type'); $Type = new Type(); $types = array(); $types[] = array('type' => 'EMAIL', 'description' => 'Email access'); $types[] = array('type' => 'TWITTER', 'description' => 'Twitter access'); foreach ($types as $type) { $Type->create(); $Type->save($type); } break; } } }
function ticket_type($id = FALSE, $condition = FALSE) { if ($condition == "delete") { $_POST["inactive"] = "1"; $type = Type::find_by_id($id); $type->update_attributes($_POST); } else { if ($_POST) { unset($_POST['send']); if ($id) { $type = Type::find_by_id($id); $type->update_attributes($_POST); } else { $type = Type::create($_POST); } if ($type) { $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_save_settings_success')); redirect('settings/ticket'); } else { $this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_save_settings_error')); redirect('settings/ticket'); } } else { if ($id) { $this->view_data['type'] = Type::find_by_id($id); } $this->view_data['title'] = $this->lang->line('application_type'); $this->view_data['form_action'] = 'settings/ticket_type/' . $id; $this->content_view = 'settings/_ticket_type'; } } $this->theme_view = 'modal_nojs'; }
public function setType($strType) { $this->_type = Type::create()->setType($strType); }