本文整理汇总了PHP中Quote::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Quote::create方法的具体用法?PHP Quote::create怎么用?PHP Quote::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quote
的用法示例。
在下文中一共展示了Quote::create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
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';
}
}
示例2: store
/**
* 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);
}
示例3: store
/**
* 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');
}
示例4: order_custom
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]);
}
示例5: foreach
$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';
示例6: getQuote
protected function getQuote($owner_id = 1)
{
return Quote::create(['owner_id' => $owner_id]);
}