當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。