<?php
$app->get('/api/users', function () {
$users = app('db')->select("SELECT * FROM users");
return response()->json([
'status' => true,
'users' => $users
]);
});
$app->get('/api/user/{id}', [ 'as' => 'user.view', function ($id) {
$user = app('db')->select("SELECT * FROM user WHERE id = ?", [ $id ]);
return response()->json([
'status' => true,
'user' => $user
]);
}]);