diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index a11b726..f179855 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -2,52 +2,40 @@ namespace App\Http\Controllers; +use App\Models\User; use Illuminate\Http\Request; class UserController extends Controller { - /** - * Display a listing of the resource. - */ + // GET /user public function index() { - // - return response("Get all users"); + return response(User::all()); } - /** - * Store a newly created resource in storage. - */ - public function store(Request $request) - { - // - return response("User store with data: " . $request->json()); - } - - /** - * Display the specified resource. - */ + // GET /user/{id} public function show(string $id) { - // - return response("User with id " . $id); + $user = User::query()->findOrFail('id', $id); + + return response($user); } - /** - * Update the specified resource in storage. - */ + // POST /user + public function store(Request $request) + { + return response("Create user"); + } + + // PUT /user/{id} public function update(Request $request, string $id) { - // return response("Update user " . $id); } - /** - * Remove the specified resource from storage. - */ + // DELETE /user/{id} public function destroy(string $id) { - // return response("Destroy user " . $id); } }