diff options
author | Marvin Borner | 2018-07-20 13:57:57 +0200 |
---|---|---|
committer | Marvin Borner | 2018-07-20 13:57:57 +0200 |
commit | 932d439444f10774bff546923cc0a2e5e2f2857b (patch) | |
tree | ef9bcc039d263f929b4f4991881a52a8343c1dfe /app/Http/Controllers/SocketController.php | |
parent | bd04ac097a0a29ba7c48a5f4a46d99ae7d86eea1 (diff) |
Rewrite (only for backend/oauth/api use from now on)
Diffstat (limited to 'app/Http/Controllers/SocketController.php')
-rwxr-xr-x | app/Http/Controllers/SocketController.php | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/app/Http/Controllers/SocketController.php b/app/Http/Controllers/SocketController.php deleted file mode 100755 index dc95ad8..0000000 --- a/app/Http/Controllers/SocketController.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -namespace App\Http\Controllers; - -use App\Http\Controllers\Controller; -use App\Message; -use Auth; -use Illuminate\Http\Request; -use LRedis; - -class SocketController extends Controller -{ - //Write Message - public function writeMessage() - { - $messages = Message::leftJoin('users', function ($join) { - $join->on('messages.user_id', '=', 'users.id'); - }) - ->select('users.name', 'messages.message')->orderBy('messages.created_at') - ->get(); - - return view('writeMessage', compact('messages')); - } - - //Send Message - public function sendMessage(Request $request) - { - $user = Auth::user(); - - $input = $request->all(); - $redis = LRedis::connection(); - - if (!isset($input['message']) || trim($input['message']) === '') { - } else { - Message::create([ - 'user_id' => $user->id, - 'message' => $input['message'], - ]); - - $data = ['message' => $input['message'], 'user' => $user->name]; - $redis->publish('message', json_encode($data)); - } - } -} |