本文整理汇总了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']]);
}
示例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'));
}