本文整理汇总了PHP中Update::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Update::create方法的具体用法?PHP Update::create怎么用?PHP Update::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Update
的用法示例。
在下文中一共展示了Update::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created update in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Update::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
Update::create($data);
return Redirect::route('updates.index');
}
示例2: createAnswer
public static function createAnswer($ticket_id, $message)
{
$update = new Update(array('ticket_id' => $ticket_id, 'user_id' => $_SESSION['user']['id'], 'type' => 'answer', 'message' => $message));
$id = $update->create();
$ticket = new Ticket(array('id' => $ticket_id));
$ticket->setNotification();
return $id;
}
示例3: Supplier
// get table link paramiters into input fields
if (isset($_GET) == true && empty($_GET) == false) {
$sup_code = $_GET['sup_code'];
$sup_name = $_GET['sup_name'];
} else {
$sup_code = "";
$sup_name = "";
}
$supplier = new Supplier();
$user = new User();
$x = escape($user->data()->name);
if ($user->isLoggedIn()) {
if (Input::exists()) {
$update = new Update();
try {
$update->create(array('date' => date("Y-m-d"), 'supplier_code' => Input::get('sup_code'), 'approved_kgs' => Input::get('app_kgs'), 'supplied_kgs' => Input::get('sup_kgs'), 'units' => Input::get('units'), 'editor' => $x, 'approved_by' => $x, 'last_editor' => $x, 'last_edit_date' => date("Y-m-d")));
} catch (Exception $e) {
die($e->getMessage());
}
Session::flash('success');
Redirect::to('supply_update.php?inserted');
}
include 'includes/head.php';
?>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<!-- Main Header -->
<?php
include 'top_nav.php';
?>
<!-- Left side column. contains the logo and sidebar -->
示例4: User
require_once 'core/init.php';
if (Session::exists('success')) {
echo Session::flash('success');
}
$user = new User();
if ($user->isLoggedIn()) {
if (Input::exists()) {
//if(Token::check(Input::get('token'))) {
if (true) {
$validate = new Validation();
$validation = $validate->check($_POST, array('sup_code' => array('required' => true), 'quantity' => array('required' => true)));
if ($validation->passed()) {
$update = new Update();
try {
$update->create(array('sup_code' => Input::get('sup_code'), 'date' => Input::get('date'), 'quantity' => Input::get('quantity'), 'approved_kgs' => Input::get('app_kgs'), 'supplied_kgs' => Input::get('sup_kgs'), 'editor' => "no-editor-yet"));
} catch (Exception $e) {
die($e->getMessage());
}
Session::flash('success', 'You have successfully registered.');
Redirect::to('index.php');
} else {
pre($validation->errors());
}
}
}
}
?>
<form action="" method="post">
<div class="field">
<label for="sup_code">Supplier Code: </label>
示例5: header
$Image->setContent($_POST["content"]);
$Image->setTags($_POST["content"]);
$Image->setLocation($_POST["location"]);
$Image->setMonth($_POST["month"]);
$Image->setDay($_POST["day"]);
$Image->setYear($_POST["year"]);
$Image->query($user["id"]);
header("Location: " . htmlspecialchars($_SERVER["HTTP_REFERER"]));
} catch (Exception $e) {
echo $e->getMessage();
}
}
} else {
$Update = new Update($user["id"], $Database);
try {
echo $_POST["month"] . '-' . $_POST["day"];
$Update->setContent($_POST["content"]);
$Update->setTags($_POST["content"]);
$Update->setCategory("text");
$Update->setMonth($_POST["month"]);
$Update->setDay($_POST["day"]);
$Update->setYear($_POST["year"]);
$Update->setLocation($_POST["location"]);
$Update->setCalendarId($_POST["calendar_id"]);
$Update->create();
header("Location: " . htmlspecialchars($_SERVER["HTTP_REFERER"]));
} catch (Exception $e) {
echo $e->getMessage();
}
}
}