@@ -50,12 +50,10 @@ discard block |
||
| 50 | 50 | $message->conversation_id = $conversation->id; |
| 51 | 51 | $message->save(); |
| 52 | 52 | return redirect()->to(url('/').'/conversation/'.$conversation->id)->send(); |
| 53 | - } |
|
| 54 | - else{ |
|
| 53 | + } else{ |
|
| 55 | 54 | return redirect()->back()->withErrors('Conversation already exists')->send(); |
| 56 | 55 | } |
| 57 | - } |
|
| 58 | - else{ |
|
| 56 | + } else{ |
|
| 59 | 57 | return redirect()->back()->withErrors('User not found')->send(); |
| 60 | 58 | } |
| 61 | 59 | } |
@@ -80,9 +78,9 @@ discard block |
||
| 80 | 78 | foreach ($thread as $conversation){ |
| 81 | 79 | if( auth()->id() == $conversation->id_to) { |
| 82 | 80 | $users[] = \Evilnet\Inbox\User::where('id', $conversation->id_from)->first(); |
| 81 | + } elseif(auth()->id() == $conversation->id_from) { |
|
| 82 | + $users[] = \Evilnet\Inbox\User::where('id', $conversation->id_to)->first(); |
|
| 83 | 83 | } |
| 84 | - elseif(auth()->id() == $conversation->id_from) |
|
| 85 | - $users[] = \Evilnet\Inbox\User::where('id', $conversation->id_to)->first(); |
|
| 86 | 84 | } |
| 87 | 85 | } |
| 88 | 86 | return $users; |