@@ -24,10 +24,10 @@ |
||
24 | 24 | { |
25 | 25 | $conversations = $this->inboxService->fetchAllConversation(); |
26 | 26 | |
27 | - $users = $this->inboxService->getInboxUsers($conversations); |
|
27 | + $users = $this->inboxService->getInboxUsers($conversations); |
|
28 | 28 | |
29 | 29 | |
30 | - return view('inbox::inbox.index', compact('conversations', 'users')); |
|
30 | + return view('inbox::inbox.index', compact('conversations', 'users')); |
|
31 | 31 | } |
32 | 32 | /** |
33 | 33 | * Show the form for creating a new resource. |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | class InboxRepository |
16 | 16 | { |
17 | - public function fetchAll() |
|
17 | + public function fetchAll() |
|
18 | 18 | { |
19 | 19 | return Conversation::where('id_from', auth()->id())->orderBy('id', 'desc')->orWhere('id_to', auth()->id())->orderBy('id', 'desc')->get()->groupBy(function ($data){ |
20 | 20 | return Carbon::parse($data->created_at)->format('Y-m-d'); |
@@ -14,7 +14,7 @@ |
||
14 | 14 | public function boot() |
15 | 15 | { |
16 | 16 | include __DIR__.'/routes.php'; |
17 | - $this->publishes([ |
|
17 | + $this->publishes([ |
|
18 | 18 | __DIR__ . '/migrations' => $this->app->databasePath() . '/migrations' |
19 | 19 | ], 'migrations'); |
20 | 20 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $a->message = $request->get('message'); |
31 | 31 | $a->conversation_id = $request->get('conv_id'); |
32 | 32 | $a->save(); |
33 | - return redirect()->back()->send(); |
|
33 | + return redirect()->back()->send(); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | public function addConversation($user,$messg,$subject){ |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | } |
58 | 58 | else{ |
59 | - return redirect()->back()->withErrors('User not found')->send(); |
|
59 | + return redirect()->back()->withErrors('User not found')->send(); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | public function fetchAllConversation(){ |
@@ -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; |