/** * Deletes a user on the panel, returns the number of records deleted. * * @param integer $id * @return integer */ public function delete($id) { if (Models\Server::where('owner', $id)->count() > 0) { throw new DisplayException('Cannot delete a user with active servers attached to thier account.'); } DB::beginTransaction(); try { Models\Permission::where('user_id', $id)->delete(); Models\Subuser::where('user_id', $id)->delete(); Models\User::destroy($id); DB::commit(); return true; } catch (\Exception $ex) { DB::rollBack(); throw $ex; } }