From 2762c62bb057f8b3a8e488797d73eb7cf493e808 Mon Sep 17 00:00:00 2001 From: Willian Damasceno Date: Sat, 8 Jun 2024 17:08:52 -0300 Subject: [PATCH] Show data in the home page --- resources/views/home.blade.php | 48 +++++++++++++++++++++++++++++++ resources/views/welcome.blade.php | 5 ---- routes/web.php | 7 ++++- 3 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 resources/views/home.blade.php delete mode 100644 resources/views/welcome.blade.php diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php new file mode 100644 index 0000000..fcb4b8b --- /dev/null +++ b/resources/views/home.blade.php @@ -0,0 +1,48 @@ +@extends('components.layouts.app') + +@section('content') +
+ @foreach ($users as $user) +
+
+
{{ $user->name }}
+
{{ $user->email }}
+
+ + +
+ @foreach ($user->pets as $pet) +
+

Dados do pet

+
Nome: {{ $pet->name }}
+
Nascimento: {{ $pet->born }}
+
Tipo: {{ $pet->type }}
+ + @if (!empty($pet->vaccines) && $pet->vaccines !== '_' && $pet->vaccines) + @php + $vaccines = explode(',', $pet->vaccines); + @endphp + @if (count($vaccines) > 1) +

Vacinas

+
+ @foreach ($vaccines as $vaccine) + @php + [$name, $date] = explode('-', $vaccine); + @endphp +
+
{{ $name }}
+
{{ $date }}
+
+ @endforeach +
+ @endif + @endif +
+ @endforeach +
+
+ @endforeach +
+@endsection diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php deleted file mode 100644 index 27352cf..0000000 --- a/resources/views/welcome.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -@extends('components.layouts.app') - -@section('content') - text -@endsection diff --git a/routes/web.php b/routes/web.php index 86a06c5..49b0788 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,7 +1,12 @@ User::all(), + 'petQuantity' => Pet::has('user')->count(), + ]); });