当前位置: 首页>>代码示例>>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;未经允许,请勿转载。