當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Task::whereId方法代碼示例

本文整理匯總了PHP中app\models\Task::whereId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Task::whereId方法的具體用法?PHP Task::whereId怎麽用?PHP Task::whereId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\Task的用法示例。


在下文中一共展示了Task::whereId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: update

 /**
  * To update task
  *
  * @param $task
  *
  * @return mixed
  */
 public function update($task)
 {
     return Task::whereId($task['id'])->update(['name' => $task['name'], 'description' => $task['description'], 'date' => Carbon::parse($task['date']), 'time' => $task['time']]);
 }
開發者ID:princesust,項目名稱:SUN-TASK,代碼行數:11,代碼來源:TaskRepository.php

示例2: updateSingleTask

 public function updateSingleTask(Project $project, $id)
 {
     $data = array();
     $data = splitString($id);
     $id = $data[0];
     $statusName = $data[2];
     $currentStatus = $data[3];
     $task = new Task();
     $affectedRows = $task->whereId($id)->orderBy('id', 'desc')->first();
     //dd($affectedRows->task_dev);
     $datetime = currentTimestamp($currentStatus);
     if ($currentStatus == "start" or $currentStatus == "restart") {
         $newStatus = "pause";
     } elseif ($currentStatus == "notStart" or $currentStatus == "end") {
         $newStatus = "start";
     } elseif ($currentStatus == "pause") {
         $newStatus = "restart";
     }
     if ($statusName == "status_des") {
         $task->task_designs = $datetime;
         $task->status_task_designs = $newStatus;
         $task->task_prod = $affectedRows->task_prod;
         $task->status_task_prod = $affectedRows->status_task_prod;
         $task->task_dev = $affectedRows->task_dev;
         $task->status_task_dev = $affectedRows->status_task_dev;
         $task->project_id = $affectedRows->project_id;
         $task->save();
     }
     if ($statusName == "status_dev") {
         $task->task_designs = $affectedRows->task_designs;
         $task->status_task_designs = $affectedRows->status_task_designs;
         $task->task_prod = $affectedRows->task_prod;
         $task->status_task_prod = $affectedRows->status_task_prod;
         $task->task_dev = $datetime;
         $task->status_task_dev = $newStatus;
         $task->project_id = $affectedRows->project_id;
         $task->save();
     }
     if ($statusName == "status_prod") {
         $task->task_designs = $affectedRows->task_designs;
         $task->status_task_designs = $affectedRows->status_task_designs;
         $task->task_prod = $datetime;
         $task->status_task_prod = $newStatus;
         $task->task_dev = $affectedRows->task_dev;
         $task->status_task_dev = $affectedRows->status_task_dev;
         $task->project_id = $affectedRows->project_id;
         $task->save();
     }
     return view('projects.show', compact('project'));
 }
開發者ID:berkapavel,項目名稱:Laravel5-Time-Tracker-Project-manager,代碼行數:50,代碼來源:PagesController.php


注:本文中的app\models\Task::whereId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。