Archived
Merge branch 'feat/user-reg-api' into fix/headerauth-crash-missing-header
This commit is contained in:
commit
8519764f8f
2 files changed
+10
-20
No files matched your search
@@ -20,7 +20,7 @@ class UserController extends Controller
|
||||
$validated['status'] = true;
|
||||
try {
|
||||
$user = User::create($validated);
|
||||
}catch (\Illuminate\Database\QueryException $exception){
|
||||
}catch (Throwable $exception){
|
||||
return response()
|
||||
->json($exception);
|
||||
}
|
||||
@@ -30,23 +30,9 @@ class UserController extends Controller
|
||||
->json(['message' => 'Successfully created user ' . $user->firstname]);
|
||||
}
|
||||
|
||||
public function getUser(Request $request, $id)
|
||||
public function getUser(Request $request, User $user)
|
||||
{
|
||||
if (!empty($id)){
|
||||
try {
|
||||
# The user exists
|
||||
$user = User::where('uuid', $id)->firstOrfail();
|
||||
return response()
|
||||
->json(["status" => true]);
|
||||
} catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
|
||||
// The user does not exist
|
||||
return response()
|
||||
->json(["status" => false]);
|
||||
}
|
||||
} else {
|
||||
return response()
|
||||
->json(["status" => "false", "message" => "Please specify UUID"]);
|
||||
}
|
||||
|
||||
return response()
|
||||
->json(["status" => true]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user