Explorar el Código

Update SearchController

Daniel Supernault hace 5 años
padre
commit
58a9ca664c
Se han modificado 1 ficheros con 8 adiciones y 4 borrados
  1. 8 4
      app/Http/Controllers/SearchController.php

+ 8 - 4
app/Http/Controllers/SearchController.php

@@ -54,7 +54,8 @@ class SearchController extends Controller
                                 'id' => (string) $item->id,
                                 'id' => (string) $item->id,
                                 'following' => $item->followedBy(Auth::user()->profile),
                                 'following' => $item->followedBy(Auth::user()->profile),
                                 'follow_request' => $item->hasFollowRequestById(Auth::user()->profile_id),
                                 'follow_request' => $item->hasFollowRequestById(Auth::user()->profile_id),
-                                'thumb' => $item->avatarUrl()
+                                'thumb' => $item->avatarUrl(),
+                                'local' => (bool) !$item->domain
                             ]
                             ]
                         ]];
                         ]];
                     } else if ($type == 'Note') {
                     } else if ($type == 'Note') {
@@ -92,7 +93,7 @@ class SearchController extends Controller
             }
             }
             return $tokens;
             return $tokens;
         });
         });
-        $users = Profile::select('username', 'name', 'id')
+        $users = Profile::select('domain', 'username', 'name', 'id')
             ->whereNull('status')
             ->whereNull('status')
             ->whereNull('domain')
             ->whereNull('domain')
             ->where('id', '!=', Auth::user()->profile->id)
             ->where('id', '!=', Auth::user()->profile->id)
@@ -113,9 +114,11 @@ class SearchController extends Controller
                     'avatar' => $item->avatarUrl(),
                     'avatar' => $item->avatarUrl(),
                     'id'     =>  $item->id,
                     'id'     =>  $item->id,
                     'entity' => [
                     'entity' => [
-                        'id' => $item->id,
+                        'id' => (string) $item->id,
                         'following' => $item->followedBy(Auth::user()->profile),
                         'following' => $item->followedBy(Auth::user()->profile),
-                        'thumb' => $item->avatarUrl()
+                        'follow_request' => $item->hasFollowRequestById(Auth::user()->profile_id),
+                        'thumb' => $item->avatarUrl(),
+                        'local' => (bool) !$item->domain
                     ]
                     ]
                 ];
                 ];
             });
             });
@@ -162,4 +165,5 @@ class SearchController extends Controller
         
         
         return view('search.results');
         return view('search.results');
     }
     }
+
 }
 }