Commit eb8d2ae0 authored by Zlimon's avatar Zlimon
Browse files

Minor error handling refactor

parent f87f0a54
Showing with 10 additions and 2 deletions
+10 -2
......@@ -146,9 +146,17 @@ public function update(Request $request, Account $account)
]);
$user = User::whereName($request->name)->orWhere('id', $request->name)->pluck('id')->first();
if (!$user) {
return response(['errors' => ['name' => ['This user could not be found.']]], 422);
$errors = [
'message' => 'Could not transfer account.',
'errors' => [
'search' => [
'This user could not be found.',
]
],
];
return response($errors, 404);
}
$account->user_id = $user;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment