|
@@ 36-45 (lines=10) @@
|
| 33 |
|
return $this->success("The user with with id {$user->id} has been created", 201); |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
public function show($id){ |
| 37 |
|
|
| 38 |
|
$user = User::find($id); |
| 39 |
|
|
| 40 |
|
if(!$user){ |
| 41 |
|
return $this->error("The user with {$id} doesn't exist", 404); |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
return $this->success($user, 200); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
public function update(Request $request, $id){ |
| 48 |
|
|
|
@@ 65-76 (lines=12) @@
|
| 62 |
|
return $this->success("The user with with id {$user->id} has been updated", 200); |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
public function destroy($id){ |
| 66 |
|
|
| 67 |
|
$user = User::find($id); |
| 68 |
|
|
| 69 |
|
if(!$user){ |
| 70 |
|
return $this->error("The user with {$id} doesn't exist", 404); |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
$user->delete(); |
| 74 |
|
|
| 75 |
|
return $this->success("The user with with id {$id} has been deleted", 200); |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
public function validateRequest(Request $request){ |
| 79 |
|
|