本文整理汇总了PHP中Update::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Update::save方法的具体用法?PHP Update::save怎么用?PHP Update::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Update
的用法示例。
在下文中一共展示了Update::save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postNewsPost
public function postNewsPost()
{
$posted = Input::get();
$update = new Update();
$update->message = $posted['message'];
$update->date = $posted['date'];
$update->save();
return Redirect::to('admin/news')->with('success', 'New update has been posted');
}
示例2: run
public function run()
{
// $faker = Faker::create();
// foreach(range(1, 10) as $index)
// {
// Update::create([
// ]);
// }
$updates = new Update();
$updates->pitch_id = 1;
$updates->update = "We are half way to our sales goal! We are so proud of everyone's involvement. Tell your friends. More is on the way.";
$updates->user_id = 1;
$updates->save();
$updates = new Update();
$updates->pitch_id = 1;
$updates->update = "We will be showing a new video this week showing our brewery facility. Get excited.";
$updates->user_id = 1;
$updates->save();
}
示例3: array
$json = array('error' => 'Your update title cannot be empty.');
exit(json_encode($json));
}
// update can't be empty
if ($message == '') {
$json = array('error' => 'Your update message cannot be empty.');
exit(json_encode($json));
}
// get acceptedID
$accepted = Accepted::getByUserID(Session::getUserID(), $task->getID());
// update status
$accepted->setStatus($status);
$accepted->save();
// create the update
$update = new Update(array('creator_id' => Session::getUserID(), 'accepted_id' => $accepted->getID(), 'project_id' => $project->getID(), 'title' => $title, 'message' => $message));
$update->save();
// save uploaded files to database
foreach ($_POST['file'] as $stored => $orig) {
$stored = Filter::text($stored);
$orig = Filter::text($orig);
Upload::saveToDatabase($orig, $stored, Upload::TYPE_UPDATE, $update->getID(), $project->getID());
}
// log it
$logEvent = new Event(array('event_type_id' => 'create_update', 'user_1_id' => Session::getUserID(), 'project_id' => $project->getID(), 'item_1_id' => $update->getID(), 'item_2_id' => $accepted->getID(), 'item_3_id' => $task->getID(), 'data_1' => $update->getTitle(), 'data_2' => $update->getMessage()));
$logEvent->save();
// we're done here
Session::setMessage('You created a new update for this task.');
$json = array('success' => '1', 'successUrl' => Url::update($update->getID()));
echo json_encode($json);
} elseif ($action == 'edit-update') {
// validate update
示例4: postupdate
public function postupdate($id)
{
$update = new Update();
$update->user_id = Auth::user()->user_id;
$update->pitch_id = $id;
$update->update = Input::get('updateText');
$update->save();
return Redirect::action('PitchesController@show', [$id]);
}
示例5: checkUpdate
/**
* Checks if the timestamp of this update has already been
* processed, if yes then we will exit, otherwise we will add
* it to the database.
*
* @return void
*/
protected function checkUpdate()
{
// If the next update is expected at another timestamp then
// we will exit the program and wait for a valid timestamp.
if (Cache::has('vatsim.nextupdate') && Carbon::now()->lt(Cache::get('vatsim.nextupdate'))) {
Log::info('Exit before next update ' . Cache::get('vatsim.nextupdate'));
exit(0);
}
// If the update already exists with the current timestamp
// then we would want to exit the program as we do not want
// any duplicate position reports
if (!is_null(Update::whereTimestamp($this->updateDate)->first())) {
Log::info('Exit already exists ' . $this->updateDate);
exit(0);
}
// Otherwise the new update time will be added to the database
$update = new Update();
$update->timestamp = $this->updateDate;
$update->save();
// Store the update ID in a class variable for position reports
$this->updateId = $update->id;
// Store the next update timestamp in the database
Cache::forever('vatsim.nextupdate', $this->nextUpdate);
}