| @@ 65-83 (lines=19) @@ | ||
| 62 | * @param int $id |
|
| 63 | * @return \Illuminate\Http\Response |
|
| 64 | */ |
|
| 65 | public function show($id) { |
|
| 66 | //return $tag = Task::findOrFail($id); |
|
| 67 | ||
| 68 | $task = Task::find($id); |
|
| 69 | ||
| 70 | if (!$task) { |
|
| 71 | return Response::json([ |
|
| 72 | 'error' => [ |
|
| 73 | 'message' => 'Task does not exist', |
|
| 74 | 'code' => 195 |
|
| 75 | ] |
|
| 76 | ], 404); |
|
| 77 | } |
|
| 78 | ||
| 79 | return Response::json([ |
|
| 80 | 'data' => $this->transform($task->toArray()) |
|
| 81 | //'data' => $task->toArray() |
|
| 82 | ],200); |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|
| 86 | * Show the form for editing the specified resource. |
|
| @@ 102-121 (lines=20) @@ | ||
| 99 | * @param int $id |
|
| 100 | * @return \Illuminate\Http\Response |
|
| 101 | */ |
|
| 102 | public function update(Request $request, $id) { |
|
| 103 | //$task = Task::findOrFail($id); |
|
| 104 | ||
| 105 | $task = Task::find($id); |
|
| 106 | ||
| 107 | if (!$task) { |
|
| 108 | return Response::json([ |
|
| 109 | 'error' => [ |
|
| 110 | 'message' => 'Task does not exist', |
|
| 111 | 'code' => 195 |
|
| 112 | ] |
|
| 113 | ], 404); |
|
| 114 | } |
|
| 115 | ||
| 116 | return Response::json([ |
|
| 117 | 'data' => $task->toArray() |
|
| 118 | ],200); |
|
| 119 | ||
| 120 | $this->saveTask($request, $task); |
|
| 121 | } |
|
| 122 | ||
| 123 | /** |
|
| 124 | * Remove the specified resource from storage. |
|
| @@ 63-81 (lines=19) @@ | ||
| 60 | * @param int $id |
|
| 61 | * @return \Illuminate\Http\Response |
|
| 62 | */ |
|
| 63 | public function show($id) { |
|
| 64 | //return $tag = Tag::findOrFail($id); |
|
| 65 | //$tag = Tag::where('id',$id)->first(); |
|
| 66 | ||
| 67 | $tag = Tag::find($id); |
|
| 68 | ||
| 69 | if (!$tag) { |
|
| 70 | return Response::json([ |
|
| 71 | 'error' => [ |
|
| 72 | 'message' => 'Tag does not exist', |
|
| 73 | 'code' => 195 |
|
| 74 | ] |
|
| 75 | ], 404); |
|
| 76 | } |
|
| 77 | ||
| 78 | return Response::json([ |
|
| 79 | 'data' => $this->transform($tag->toArray()) |
|
| 80 | ],200); |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * Show the form for editing the specified resource. |
|
| @@ 100-119 (lines=20) @@ | ||
| 97 | * @param int $id |
|
| 98 | * @return \Illuminate\Http\Response |
|
| 99 | */ |
|
| 100 | public function update(Request $request, $id) { |
|
| 101 | //$tag = Tag::findOrFail($id); |
|
| 102 | ||
| 103 | $tag = Tag::find($id); |
|
| 104 | ||
| 105 | if (!$tag) { |
|
| 106 | return Response::json([ |
|
| 107 | 'error' => [ |
|
| 108 | 'message' => 'Task does not exist', |
|
| 109 | 'code' => 195 |
|
| 110 | ] |
|
| 111 | ], 404); |
|
| 112 | } |
|
| 113 | ||
| 114 | return Response::json([ |
|
| 115 | 'data' => $tag->toArray() |
|
| 116 | ],200); |
|
| 117 | ||
| 118 | $this->saveTag($request, $tag); |
|
| 119 | } |
|
| 120 | ||
| 121 | /** |
|
| 122 | * Remove the specified resource from storage. |
|