本文整理汇总了PHP中Task::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::find方法的具体用法?PHP Task::find怎么用?PHP Task::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$task = Task::find($id);
if ($task) {
$task->delete();
}
}
示例2: completeTask
public function completeTask()
{
$id = $_GET['id'];
$Task = Task::find($id);
$Task->complete();
return Redirect::back();
}
示例3: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$tasks = Task::find($id);
$tasks->delete();
// redirect
return Redirect::route('tasks.index');
}
示例4: edit
public static function edit($id)
{
self::check_logged_in();
$task = Task::find($id);
$task->projectids = explode(",", $task->projectids);
$projects = Project::all();
View::make('task/edit.html', array('attributes' => $task, 'projects' => $projects));
}
示例5: destroy
public function destroy($id_task)
{
$task = Task::find($id_task);
if ($task) {
$task->delete();
}
return Redirect::route('index_admin');
}
示例6: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$input = Input::json();
$task = Task::find($id);
$task->title = $input->get('title');
$task->completed = $input->get('completed');
$task->save();
}
示例7: cleanDeadTasks
/**
* Check dead tasks for current worker, and break it if dead.
*/
public function cleanDeadTasks()
{
$deadTasks = Task::find()->andWhere(['status' => 'in-progress'])->andWhere('dead_time > NOW()')->all();
foreach ($deadTasks as $deadTask) {
$deadTask->status = 'aborted';
$deadTask->save();
}
return true;
}
示例8: update
/**
* Update the specified resource in storage.
* PUT /tasks/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
$task = Task::where('id', $id)->update(Input::all());
if ($task) {
$data = Task::find($id);
return ['status' => true, 'data' => $data];
} else {
return ['status' => false];
}
}
示例9: getEmailtaskopened
public function getEmailtaskopened($id = false)
{
if (!$id) {
return App::abort(404);
}
$task = Task::find($id);
if (!$task) {
return App::abort(404);
}
Taskemails::taskOpened($task);
}
示例10: test_find
function test_find()
{
$description = "Wash the dog";
$description2 = "Water the lawn";
$test_Task = new Task($description);
$test_Task->save();
$test_Task2 = new Task($description2);
$test_Task2->save();
$id = $test_Task->getId();
$result = Task::find($id);
$this->assertEquals($test_Task, $result);
}
示例11: complete
public function complete($id)
{
$date = time();
$task = Task::find($id);
$task->done_at = $date;
$task->isDone = 1;
$task->save();
$tache = Task::where('id', '=', $id)->get();
$titre = $tache[0]->title;
Session::flash('completed', "La tâche <em>{$titre}</em> a bien été complété.");
return Redirect::to(URL::previous());
}
示例12: updateOrder
public function updateOrder()
{
Log::debug(__METHOD__);
if (Input::get('id') == null) {
return 'update_order noop';
}
// 並び順の変更はタイムスタンプを更新したくない
foreach (Input::get('id') as $i => $task_id) {
$target_task = Task::find($task_id);
$target_task->timestamps = false;
$target_task->order_no = $i;
$target_task->save();
$target_task->timestamps = true;
}
return 'update_order ok';
}
示例13: edit
public function edit(Request $request, $id)
{
//$tache=new Task();
//$tache=Task::all()->where('user_id',$id);
$user = Auth::user()->id;
$tache = Task::where('id', $id)->where('user_id', $user)->get();
if (!$tache->isEmpty()) {
//Ecriture dans la DB de la forme Tache
$input = $request->all();
$tache = new Task();
$tache = Task::find($id);
$tache->user_id = $user;
$tache->name = $request->input('tache');
$tache->descriptionTache = $request->input('description');
$tache->update();
return redirect('/list')->with('flash_message', 'Modifié avec succés');
} else {
return redirect('/list')->with('flash_message_bad', "Erreur vous avez modifié l'id");
}
}
示例14: workflowSubmit
public function workflowSubmit()
{
$designation = e(Input::get('designa'));
if ($designation == 0) {
$des_name = "";
} else {
$des = Designation::find($designation);
$des_name = e($des->designation);
}
$id = Input::get('task_id');
$assignd = Task::find($id);
$assignd->designation_id = Input::get('designa');
$assignd->save();
if ($designation == 0) {
$data = array("html" => "<div id='insert_{$id}' class='mode1'> None </div> <input type='hidden' id='hide_currentDesignation' class='hide_currentDesignation' value='0' > ");
} else {
$data = array("html" => "<div id='insert_{$id}' class='mode1'> {$des_name} </div> <input type='hidden' id='hide_currentDesignation' class='hide_currentDesignation' value='{$assignd->designation_id}' > ");
}
return Response::json($data);
}
示例15: getEntries
public function getEntries($day, $userId)
{
try {
//Get the entries
$tempEntries = Timesheet::where('date', $day)->where('user_id', $userId)->get()->toArray();
$finalEntries = array();
//Get Task Name
foreach ($tempEntries as $entry) {
if ($entry['task_id'] != null) {
$entry['task'] = \Task::find($entry['task_id'])->toArray();
} else {
$entry['task'] = null;
}
$finalEntries[] = $entry;
}
return $finalEntries;
} catch (\Exception $e) {
\Log::error('Something Went Wrong in Timesheet Repository - getEntries():' . $e->getMessage());
throw new SomeThingWentWrongException();
}
}