Return a 404 if attempting to delete a user that does not exist; closes #503
This commit is contained in:
parent
30e0495489
commit
32b639e3eb
1 changed files with 3 additions and 1 deletions
|
@ -151,6 +151,8 @@ class UserRepository
|
||||||
*/
|
*/
|
||||||
public function delete($id)
|
public function delete($id)
|
||||||
{
|
{
|
||||||
|
$user = Models\User::findOrFail($id);
|
||||||
|
|
||||||
if (Models\Server::where('owner_id', $id)->count() > 0) {
|
if (Models\Server::where('owner_id', $id)->count() > 0) {
|
||||||
throw new DisplayException('Cannot delete a user with active servers attached to thier account.');
|
throw new DisplayException('Cannot delete a user with active servers attached to thier account.');
|
||||||
}
|
}
|
||||||
|
@ -170,7 +172,7 @@ class UserRepository
|
||||||
$subuser->delete();
|
$subuser->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
Models\User::destroy($id);
|
$user->delete();
|
||||||
DB::commit();
|
DB::commit();
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
|
|
Loading…
Reference in a new issue