本文整理汇总了PHP中Illuminate\Support\Facades\DB::update方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::update方法的具体用法?PHP DB::update怎么用?PHP DB::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\DB
的用法示例。
在下文中一共展示了DB::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendlist
public function sendlist()
{
$id = $_GET['id'];
$dispatchlist = Dispatchlist::find($id);
\Illuminate\Support\Facades\DB::update("update dispatchlists set status='active' WHERE id='{$dispatchlist->id}'");
return Redirect::to('dispatchlist');
}
示例2: handle
/**
* Execute the console command.
*/
public function handle()
{
$file = base_path('resources') . '/new_name.txt';
$handle = fopen($file, 'r');
if (!$handle) {
throw new FileNotFoundException($file);
}
while (($line = fgets($handle)) !== false) {
$data = explode("\t", $line);
if (count($data) != 2) {
continue;
}
$newName = trim($data[1]);
if (empty($newName)) {
continue;
}
DB::update('update organizations set fullName=' . DB::connection()->getPdo()->quote($newName) . ' where edrpou=' . DB::connection()->getPdo()->quote($data[0]) . ' limit 1');
var_dump(1);
// if(++$j >= 2000) {
// $values = implode(', ', array_map(function($v){
// foreach($v as &$vv)
// $vv = DB::connection()->getPdo()->quote($vv);
// return '('. implode(',', $v) .')';
// }, $rows));
//
// DB::insert('insert ignore into `fio` (`name`, `nameRU`) values '. $values .' ON DUPLICATE KEY UPDATE c=c+1');
// $j = 0;
// $rows = [];
// }
}
fclose($handle);
}
示例3: mesajOku
function mesajOku($oku)
{
$mesajOku = DB::select("select k.adi,k.soyadi,m.mesaj,m.tarih from mesajlar as m left join kullanicilar as k on m.gonderen_id=k.id where m.id = ? limit 0,1", array($oku));
$d = DB::update('update mesajlar set durum=1 where id = ?', array($oku));
$kullanici["user"] = $mesajOku[0];
return view('admin/mesajOku', array('kullanici' => $kullanici));
}
示例4: duzenleUrun
public function duzenleUrun($urun_id)
{
$form = Input::all();
$kural = array('kategori_id' => 'required', 'baslik' => 'required', 'kisa_aciklama' => 'required', 'aciklama' => 'required', 'fiyat' => 'required', 'kampanya' => 'required', 'piyasa_fiyati' => 'required', 'durum' => 'required', 'stok' => 'required');
$dogrulama = \Validator::Make($form, $kural);
if ($dogrulama->fails()) {
// gönderilen verilerde hata var
return \Redirect::to('admin/urunDuzenle/' . $urun_id)->withErrors($dogrulama)->withInput();
}
$form["bugunteslimat"] = isset($form["bugunteslimat"]) ? 1 : 0;
$form["coksatan"] = isset($form["coksatan"]) ? 1 : 0;
$form["kargobedava"] = isset($form["kargobedava"]) ? 1 : 0;
$form["indirimliurun"] = isset($form["indirimliurun"]) ? 1 : 0;
$form["onecikan"] = isset($form["onecikan"]) ? 1 : 0;
$q = "UPDATE urunler SET kategori_id = ?, baslik=? , kisa_aciklama = ?, aciklama = ?, fiyat=? ,kampanya=? ,piyasa_fiyati=? ,durum=? ,stok=?, one_cikan=?, indirimli_urun=?, cok_satan=?, kargo_bedava=?, bugun_teslimat=? WHERE id = ?";
$islem = DB::update($q, array($form["kategori_id"], $form["baslik"], $form["kisa_aciklama"], $form["aciklama"], $form["fiyat"], $form["kampanya"], $form["piyasa_fiyati"], $form["durum"], $form["stok"], $form["onecikan"], $form["indirimliurun"], $form["coksatan"], $form["kargobedava"], $form["bugunteslimat"], $urun_id));
if ($islem) {
$mesaj = "basarili";
return Redirect::to("admin/urun")->with("mesaj", $mesaj);
} else {
$mesaj = "basarisiz";
return Redirect::to("admin/urun")->with("mesaj", $mesaj);
}
// Mesaj session'a yazılıyor redirect yapıldığı için.
}
示例5: updateData
/**
* UPDATE query
* @param array $content string contendo campos e valores que serao atualizados
* @param string $filter string com filtro para atualização
*/
public function updateData($dados, $filter)
{
$this->validateTable();
$dados = key($dados) . ' = ' . $dados[key($dados)];
$filter = key($filter) . ' = ' . $filter[key($filter)];
return DB::update('UPDATE ' . $this->table_name . ' SET ' . $dados . ' WHERE ' . $filter);
}
示例6: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('dramas', function (Blueprint $table) {
$table->integer('favorites')->after('reviews')->default(0);
});
DB::update('update dramas set favorites=(select count(*) from favorites where drama_id=dramas.id and deleted_at is null)');
}
示例7: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//GOAL TRAVEL
$qt = "UPDATE \t goal_travel\n SET duration_complete = duration_complete +1\n WHERE\t\tduration_complete < duration\n AND\t\t\tflg=1";
//GOAL CAR
$qc = "UPDATE \t goal_car\n SET duration_complete = duration_complete +1\n WHERE\t\tduration_complete < duration\n AND\t\t\tflg=1";
//GOAL GENERAL
$qg = "UPDATE \t goal_general\n SET duration_complete = duration_complete +1\n WHERE\t\tduration_complete < duration\n AND\t\t\tflg=1";
//GOAL HOME
$qh = "UPDATE \t goal_home\n SET duration_complete = duration_complete +1\n WHERE\t\tduration_complete < duration\n AND\t\t\tflg=1";
if (!DB::update($qt)) {
echo "log error - travel";
}
if (!DB::update($qc)) {
echo "log error - car";
}
if (!DB::update($qg)) {
echo "log error - general";
}
if (!DB::update($qh)) {
echo "log error - home";
}
/**
* Update the flg to zero is goal completed
*/
$qu = "UPDATE \tgoal_general\n SET\t flg=0\n WHERE\t\tduration_complete = duration";
DB::update($qu);
$qu = "UPDATE \tgoal_travel\n SET\t flg=0\n WHERE\t\tduration_complete = duration";
DB::update($qu);
$qu = "UPDATE \tgoal_car\n SET\t flg=0\n WHERE\t\tduration_complete = duration";
DB::update($qu);
$qu = "UPDATE \tgoal_home\n SET\t flg=0\n WHERE\t\tduration_complete = duration";
DB::update($qu);
}
示例8: clear
public function clear(Request $request)
{
$post = $request->all();
$comment = $post['comment'];
$value = $post['amount'];
$student = $post['regNo'];
$clearedAt = $post['signedAt'];
$clearedBy = $post['signedBy'];
$comment = preg_replace('/[^A-Za-z0-9 _]/', '', $comment);
$value = preg_replace('/[^0-9]/', '', $value);
DB::beginTransaction();
$submit = DB::update("UPDATE charge\n INNER JOIN comments ON charge.students_studentNo = comments.students_studentNo\n INNER JOIN cleared_at ON charge.students_studentNo = cleared_at.students_studentNo\n INNER JOIN cleared_by ON charge.students_studentNo = cleared_by.students_studentNo\n SET\n charge.cafeteria_value = '{$value}',\n charge.queueFlag = charge.queueFlag + 1,\n comments.cafeteria = '{$comment}',\n cleared_at.cafeteria_cleared_at = '{$clearedAt}',\n cleared_by.cafeteria_cleared_by = '{$clearedBy}'\n\n WHERE charge.students_studentNo = '{$student}'\n AND comments.students_studentNo = '{$student}'\n AND cleared_at.students_studentNo = '{$student}'\n AND cleared_by.students_studentNo='{$student}' ");
if ($submit) {
DB::commit();
} else {
DB::rollBack();
}
// $admin = DB::table('departments')
// ->join('administrators','departments.administrator','=','administrators.admin_id')
// ->select('administrators.email')->where('departments.department_name','=','Library')
// ->pluck('email');
//Send Mail
// Mail::send('mails.clear', ['student' => $student ], function($message) use($admin){
// $message->to($admin)->from('strath.clearance@gmail.com', 'Strathmore University')->subject('Clearance');
// });
return redirect('/cafeteria');
}
示例9: bannerDuzenleKaydet
function bannerDuzenleKaydet($duzenle)
{
$form = input::all();
// $kural = array('ad'=>'required','yol'=>'required','genislik'=>'required','yukseklik'=>'required','url'=>'required','durum'=>'required');
// $dogrulama = \Validator::Make($form,$kural);
// if($dogrulama->fails()) {
// // gönderilen verilerde hata var
// return Redirect::to('admin/bannerDuzenle/'. $duzenle)->withErrors($dogrulama)->withInput();
// }else{
$dosya = Input::file('dosya');
$uzanti = $dosya->getClientOriginalExtension();
$dosyaAdi = date('YmdHis') . "_b." . $uzanti;
$path = base_path('bannerResimler/' . $dosyaAdi);
$imagePath = 'bannerResimler/' . $dosyaAdi;
Image::make($dosya->getRealPath())->save($path);
$sorgu = "UPDATE banner SET ad=?,yol=?, genislik=?, yukseklik=?, url=?, durum=? WHERE id=?";
$islem = DB::update($sorgu, array($form["ad"], $dosyaAdi, $form["genislik"], $form["yukseklik"], $form["url"], $form["durum"], $duzenle));
if ($islem) {
$mesaj = "basarili";
return Redirect::to("admin/bannerListele")->with("mesaj", $mesaj);
} else {
$mesaj = "başarısız";
return Redirect::to("admin/bannerListele")->with("mesaj", $mesaj);
}
}
示例10: setStatus
public function setStatus(Request $request)
{
$input = $request->all();
$workId = $input['workId'];
$status = $input['status'];
$affected = DB::update('UPDATE work_status SET STATUS = ? WHERE work_id = ?', [$status, $workId]);
}
示例11: approve
static function approve($id, $pass)
{
$entry = DB::select("SELECT password FROM Entries WHERE rowid=?", [$id]);
if (Hash::check($pass, $entry[0]->password)) {
return DB::update("UPDATE Entries SET is_approved=1, password=? WHERE rowid=?", [Hash::make($pass), $id]);
}
return 0;
}
示例12: finishTest
/**
* Завершает текущий тест
* @param $levelId
* @return array
*/
public function finishTest($levelId)
{
$testId = $this->currentTestId($levelId);
$query = 'UPDATE tests SET is_passed = TRUE, pass_datetime = now(), pass_duration = (SELECT EXTRACT(MINUTE FROM (now() - start_datetime))) WHERE id = ' . $testId . ';';
DB::update(DB::raw($query));
ProfileController::updatePoints($testId);
return ['is_finished' => true];
}
示例13: show
public function show()
{
if ($this->record->owner_id == Auth::User()->id && empty($this->record->read_by_owner)) {
DB::update('update leads set read_by_owner=1 where id="' . $this->record->id . '"');
}
$activityList = $this->relatedActivityList();
return View('lead/lead-view', ['record' => $this->record, 'activityList' => $activityList, 'editPath' => 'lead']);
}
示例14: update
static function update($game)
{
DB::update('UPDATE Games SET name=:name, num_players=:num_players, nickname_field=:nickname_field, multicampus=:multicampus WHERE rowid=:rowid', $game);
// DB::delete('DELETE FROM Fields WHERE id_game=:rowid', $game);
// if (!empty($game->extra_fields)) {
// this.insertFields($game->rowid, $game->extra_fields);
// }
return 1;
}
示例15: setCursillosEsRespuesta
public static function setCursillosEsRespuesta($cursillosIds = array())
{
$recordsCount = 0;
DB::transaction(function () use(&$recordsCount, $cursillosIds) {
$ids = implode(",", $cursillosIds);
$recordsCount = DB::update("update cursillos set esRespuesta=true where (esRespuesta = false and activo = true and id in ({$ids}))");
});
return $recordsCount;
}