function index() { if ($_POST) { unset($_POST['send']); $_POST = array_map('htmlspecialchars', $_POST); $_POST['status'] = "New"; $_POST['date'] = date("Y-m-d H:i", time()); $item = Quote::create($_POST); if (!$item) { $this->session->set_flashdata('message', 'error:' . $this->lang->line('quotation_create_error')); } else { $this->load->helper('notification'); $this->session->set_flashdata('message', 'success:' . $this->lang->line('quotation_create_success')); $admins = User::find('all', array('conditions' => array('admin = ? AND status = ?', '1', 'active'))); foreach ($admins as &$value) { send_notification($value->email, $this->lang->line('application_notification_quotation_subject'), $this->lang->line('application_notification_quotation')); } } redirect('quotation'); } else { $this->theme_view = 'fullpage'; $this->view_data['form_action'] = 'quotation'; $this->content_view = 'quotation/_main'; } }
/** * Show the form for creating a new resource. * * @return Response */ public function store() { // validate input if (!Input::has('quote')) { return Response::make('Bad Request', 400); } // write records $quote = Quote::create(['quote' => Input::get('quote'), 'author' => Input::has('author') ? Input::get('author') : 'John Doe', 'image' => Input::has('image') ? Input::get('image') : asset('res/stub.jpg')]); // done return Response::json($quote); }
/** * Store a newly created quote in storage. * * @return Response */ public function store() { if (!Sentry::getUser()) { return Redirect::route('sessions.create'); } $validator = Validator::make($data = Input::all(), Quote::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $data['event_date'] = strtotime($data['event_date']); Quote::create($data); return Redirect::route('finances.index'); }
public function order_custom($params = []) { $parts = Part::get_parts(); $order = Record::allow($params, array_keys($parts)); $key = Quote::get_unique_key([]); $model['`key`'] = $key; $fields = ['company', 'address', 'country', 'billing_name', 'billing_email', 'billing_phone', 'technical_name', 'technical_email', 'discount', 'discount_desc']; $model += Record::allow($params, $fields); $quote = Quote::create($model); $total = 0; foreach ($order as $name => $value) { if ($value) { $model = ['quote_id' => $quote['id'], 'part' => $name, 'override' => null, 'quantity' => $value]; QuoteItem::create($model); } } return Render::json(['key' => $key]); }
$mailer->headers($headers); $mailer->send(); foreach ($_POST['contact'] as $key => $value) { if (is_array($value)) { $value = implode(';', $value); } $data[$key] = addslashes($value); } $data['created_at'] = date('Y-m-d H:i:s'); $data['updated_at'] = date('Y-m-d H:i:s'); $postQuery = 'INSERT INTO `contact` (`'; $postQuery .= implode('`, `', array_keys($data)); $postQuery .= '`) VALUES (\''; $postQuery .= implode('\', \'', array_values($data)); $postQuery .= '\');'; $success = mysql_query($postQuery); Flash::add('success', 'Thanks for your submission. We\'ll contact you shortly.'); $URL = '/contact.php'; break; case 'quote': $quote = new Quote(); $quote->create($_POST['quote']); Flash::add('success', 'Thanks for your submission. We\'ll contact you shortly.'); $URL = '../quote.php'; break; default: exit; break; } header("Location: {$URL}"); include './closedb.php';
protected function getQuote($owner_id = 1) { return Quote::create(['owner_id' => $owner_id]); }