当前位置: 首页>>代码示例>>PHP>>正文


PHP Task::findOrFail方法代码示例

本文整理汇总了PHP中app\models\Task::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::findOrFail方法的具体用法?PHP Task::findOrFail怎么用?PHP Task::findOrFail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Task的用法示例。


在下文中一共展示了Task::findOrFail方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 /**
  * Update the specified resource in storage via ajax.
  */
 public function update(TaskRequest $request, $id)
 {
     if ($request->ajax()) {
         $task = Task::findOrFail($id);
         $task->update($request->all());
         return $task;
     }
     return view('errors.404');
 }
开发者ID:unclefudge,项目名称:whs,代码行数:12,代码来源:TaskController.php

示例2: update

 public function update($id, TaskRequest $request)
 {
     $task = Task::findOrFail($id);
     $task->name_en = $request->input('name_en');
     $task->name_bn = $request->input('name_bn');
     $task->component_id = $request->input('component_id');
     $task->module_id = $request->input('module_id');
     $task->route = $request->input('route');
     $task->icon = $request->input('icon');
     $task->description = $request->input('description');
     $task->ordering = $request->input('ordering');
     $task->updated_by = Auth::user()->id;
     $task->updated_at = time();
     $task->update();
     Session()->flash('flash_message', 'Task has been updated!');
     return redirect('tasks');
 }
开发者ID:saj696,项目名称:pipe,代码行数:17,代码来源:TasksController.php

示例3: find

 /**
  * To find tasks with given id
  *
  * @param $id
  *
  * @return task
  */
 public function find($id)
 {
     return Task::findOrFail($id);
 }
开发者ID:princesust,项目名称:SUN-TASK,代码行数:11,代码来源:TaskRepository.php

示例4: destroy

 /**
  * @param $id
  *
  * @return \Illuminate\Http\JsonResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function destroy($id)
 {
     try {
         $task = Task::findOrFail($id);
         $task->delete();
         $response = ['code' => 204, 'message' => 'No Content'];
         return response()->json($response, $response['code']);
     } catch (ModelNotFoundException $e) {
         $response = ['code' => 404, 'message' => 'Not Found'];
         return response()->json($response, $response['code']);
     }
 }
开发者ID:richriscunha,项目名称:vuedue,代码行数:17,代码来源:TaskController.php

示例5: show

 public function show($taskId)
 {
     $taskId = intval($taskId);
     $task = Task::findOrFail($taskId);
     if (!$task->is_active) {
         return redirect('/');
     }
     if ($task->taskers_only && !$this->user) {
         return redirect('/auth/login');
     }
     ViewMapper::trackTask($task);
     return view('pages.task.show', compact('task'));
 }
开发者ID:blozixdextr,项目名称:tuasist2,代码行数:13,代码来源:TaskController.php

示例6: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(TaskRequest $request, $id)
 {
     $timeline['action'] = 'update';
     $camp = Task::findOrFail($id);
     $input = $request->all();
     if ($camp->status != $input['status']) {
         $timeline['description'] = '<a href="javascript:;">' . Auth::user()->first_name . ' ' . Auth::user()->last_name . '</a> changed the ' . $camp->title . ' task status to ' . $input['status'] . '.';
     } else {
         $timeline['description'] = '<a href="javascript:;">' . $camp->title . '</a> task has been updated by ' . Auth::user()->first_name . ' ' . Auth::user()->last_name . '.';
     }
     $input['updated_by'] = Auth::user()->id;
     $camp->fill($input);
     $camp->save();
     Session::flash($this->success, Lang::get('ruban.task.updated'));
     $timeline['object_type'] = 6;
     $timeline['object_id'] = $id;
     Timeline::create($timeline);
     return Redirect::route('ruban.tasks.index');
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:25,代码来源:TaskController.php


注:本文中的app\models\Task::findOrFail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。