/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { session_start(); if (!isset($_SESSION['AUTH']) || $_SESSION['AUTH'] == false) { \App::abort(500, 'User not authenticated'); } $i = instanceUser::find($id); try { //emit request to make db $redis = \Redis::connection(); // Using the Redis extension provided client $redis->publish('demeter', json_encode(array('command' => 'deleteInstanceUser', 'vm' => $i->instance->vmId, 'instanceId' => $i->instance->id, 'instanceName' => $i->instance->name, 'username' => $i->name, 'netId' => $_SESSION['AUTH_USER']))); if ($i->delete()) { echo "success"; } else { \App::abort(500, 'User could not be deleted, please contact an Administrator'); } } catch (Exception $e) { \App::abort(500, 'User could not be deleted, please contact an Administrator'); } }