Skip to content

Commit 5b718cb

Browse files
authored
Merge pull request #17 from danillobion/contagemRequisicoes
Contagem requisicoes
2 parents 5c4dae0 + c0b4915 commit 5b718cb

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

app/Models/Usuario.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ class Usuario extends Authenticatable
3434
'password',
3535
'remember_token',
3636
];
37+
38+
protected $appends = [
39+
'quantidade_total_requisicoes',
40+
];
3741

3842
/**
3943
* Get the attributes that should be cast.
@@ -46,7 +50,7 @@ protected function casts(): array
4650
'email_verified_at' => 'datetime',
4751
'password' => 'hashed',
4852
];
49-
}
53+
}
5054

5155
public function tipo(){
5256
return $this->belongsTo(Tipo::class);
@@ -63,4 +67,10 @@ public function hasPermission(string $permission): bool {
6367

6468
}
6569

70+
// Quantidade total de requisições
71+
public function getQuantidadeTotalRequisicoesAttribute(){
72+
$quantidade = LogConsulta::where('usuario_id', $this->id)->count();
73+
return $quantidade;
74+
}
75+
6676
}

public/favicon_normal.png

20.3 KB
Loading

resources/js/Pages/Admin/Usuarios/index.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const deletarUsuario = (produto_id) => {
4343
<th scope="col" class="px-6 py-3">Nome</th>
4444
<th scope="col" class="px-6 py-3">E-mail</th>
4545
<th scope="col" class="px-6 py-3">Tipo de usuário</th>
46+
<th scope="col" class="px-6 py-3">Nº total Requisições</th>
4647
<th scope="col" class="px-6 py-3">Ações</th>
4748
</tr>
4849
</thead>
@@ -63,6 +64,9 @@ const deletarUsuario = (produto_id) => {
6364
{{ usuario.tipo.descricao }}
6465
</p>
6566
</td>
67+
<td class="px-6 py-4">
68+
{{ usuario.quantidade_total_requisicoes }}
69+
</td>
6670
<td class="px-6 py-4 flex inline-flex space-x-2">
6771
<Link
6872
:href="route('usuario.editar', { id: usuario.id })"

resources/views/app.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<!-- Fonts -->
1010
<link rel="preconnect" href="https://fonts.bunny.net">
1111
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
12+
<link rel="Nova Era Placas" type="image/png" href="/favicon_normal.png"/>
1213

1314
<!-- Scripts -->
1415
@routes

0 commit comments

Comments
 (0)