Selaa lähdekoodia

style: :lipstick: style(listagem clientes e prestadores) reordenando listagem de clientes e prestadores

reordenada alfabeticamente a listagem de clientes e prestadores no backoffice

fase:staging | origin:melhoria-interna
Gustavo Zanatta 3 viikkoa sitten
vanhempi
commit
244c18c588
2 muutettua tiedostoa jossa 8 lisäystä ja 2 poistoa
  1. 5 1
      app/Services/ClientService.php
  2. 3 1
      app/Services/ProviderService.php

+ 5 - 1
app/Services/ClientService.php

@@ -23,7 +23,11 @@ class ClientService
 
     public function getAll(): Collection
     {
-        return Client::with(['user', 'profileMedia'])->get();
+        return Client::with(['user', 'profileMedia'])
+          ->join('users', 'clients.user_id', '=', 'users.id')
+          ->orderBy('users.name')
+          ->select('clients.*')
+          ->get();
     }
 
     public function findById(int $id): ?Client

+ 3 - 1
app/Services/ProviderService.php

@@ -30,7 +30,9 @@ class ProviderService
     {
         $providers = Provider::query()
             ->with(['user', 'profileMedia'])
-            ->orderBy('created_at', 'desc')
+            ->join('users', 'providers.user_id', '=', 'users.id')
+            ->select('providers.*')
+            ->orderBy('users.name', 'asc')
             ->get();
 
         return $providers;