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


PHP Task::find方法代碼示例

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


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

示例1: complete

 public function complete($id)
 {
     $task = Task::find($id);
     $task->completed_at = Carbon::now();
     $task->save();
     return redirect('/tasks');
 }
開發者ID:sezertunca,項目名稱:laravel-tasks,代碼行數:7,代碼來源:TasksController.php

示例2: edit

 public function edit($id)
 {
     $param['pageNo'] = 1;
     $result = TaskModel::find($id);
     $param['tasks'] = $result;
     return View::make('company.task.edit')->with($param);
 }
開發者ID:michaelotto126,項目名稱:shokes,代碼行數:7,代碼來源:TaskController.php

示例3: show

 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     //
     $tasks = Task::find($id);
     $taskforms = TaskForm::where('task_id', $id)->with('device', 'task')->get();
     return view('taskforms.index')->with('tasks', $tasks)->with('taskforms', $taskforms);
 }
開發者ID:sunhuang2015,項目名稱:mytask,代碼行數:13,代碼來源:TaskFormController.php

示例4: destroy

 public function destroy($id)
 {
     $response = Task::find($id)->delete();
     if ($response) {
         return redirect('/');
     }
 }
開發者ID:nayem73cse12,項目名稱:Laravel_first_CRUD,代碼行數:7,代碼來源:TodoController.php

示例5: markComplete

 public function markComplete($taskId)
 {
     $task = Task::find($taskId);
     $task->completed = true;
     $task->save();
     return redirect()->route('tasks');
 }
開發者ID:leejunkit,項目名稱:vashti,代碼行數:7,代碼來源:HomeController.php

示例6: updateTask

 public function updateTask($id)
 {
     $task = Task::find($id);
     $task->update(Input::all());
     Flash::success('Task was updated');
     return redirect()->back();
 }
開發者ID:jdelise,項目名稱:career_site,代碼行數:7,代碼來源:TaskController.php

示例7: update

 public function update(Request $request, $id)
 {
     array_forget($request, "_token");
     $all_request = $request->all();
     $task = Task::find($id);
     foreach ($all_request as $key => $value) {
         /*
          * remove all underscore contained
          * in the edit form field
          */
         $key = preg_replace("/^_/", "", $key);
         $task->{$key} = $value;
     }
     if ($task->update()) {
         \Session::flash("success_message", "Task Successfully Updated");
     } else {
         \Session::flash("error_message", "Unexpected Error Task could not be updated");
     }
     $tasks = Task::all();
     if ($request->ajax()) {
         response()->json("Task Successfully Updated");
         exit;
         // return \Redirect::back();
     }
     return View("taskmanager.index", ['tasks' => $tasks, 'title' => 'Tasks']);
 }
開發者ID:runningjack,項目名稱:coalitionlaravel2,代碼行數:26,代碼來源:TaskController.php

示例8: destroy

 public function destroy(Request $request, $taskId)
 {
     $task = Task::find($taskId);
     //$this->authorize('destroy', $task);
     $task->delete();
     return redirect('/tasks');
 }
開發者ID:phuongnguyen2311,項目名稱:lavarel,代碼行數:7,代碼來源:TaskController.php

示例9: getDelete

 public function getDelete($id)
 {
     $task = \App\Task::find($id);
     $project_id = $task->project_id;
     $task->delete();
     \Session::flash('flash_message', 'Your task was deleted.');
     return redirect('/tasks/show/' . $project_id);
 }
開發者ID:annaphp,項目名稱:p4,代碼行數:8,代碼來源:TasksController.php

示例10: update

 public function update($id, Request $request)
 {
     $task = Task::find($id);
     $task->name = $request->name;
     $task->address = $request->address;
     $task->save();
     return redirect('/tasks');
 }
開發者ID:ellianadwi,項目名稱:LARAVEL,代碼行數:8,代碼來源:TaskController.php

示例11: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     // Bind Tasks by full object translated from ID
     $router->bind('tasks', function ($id) {
         return \App\Task::find($id);
     });
 }
開發者ID:kmassada,項目名稱:laravel-angular,代碼行數:14,代碼來源:RouteServiceProvider.php

示例12: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $task = Task::find($id);
     if (!$task) {
         return $this->respondNotFound('Task does not exist');
     }
     return $this->respond(['data' => $this->taskTransformer->transform($task)]);
 }
開發者ID:alexbonavila,項目名稱:taskAPI,代碼行數:14,代碼來源:TaskController.php

示例13: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $task_id)
 {
     $task = Task::find($task_id);
     $task->task = $request->task;
     $task->description = $request->description;
     $task->save();
     return \Response::json($task);
 }
開發者ID:swilliamrobert,項目名稱:mall-app,代碼行數:14,代碼來源:TaskController.php

示例14: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     // TODO: implement a validation for this method
     $arrRet = array("success" => true);
     $task = Task::find($id);
     $task->delete();
     return response()->json($arrRet);
 }
開發者ID:tanko2224,項目名稱:envoy-todo-list,代碼行數:14,代碼來源:TaskController.php

示例15: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $task = Task::find($id);
     // $task = Task::where('id',$id)->first();
     if (!$task) {
         return Response::json(['error' => ['message' => 'La tasca no existeix', 'code']], 404);
     }
     return Response::json([$this->taskTransfomer->transform($task)], 200);
 }
開發者ID:sergipineda,項目名稱:tasksAPI,代碼行數:15,代碼來源:TaskController.php


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