diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index 3ec9546d..85e836b0 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -11,7 +11,7 @@ public function users()
{
$usersCount = User::count();
- return view('users');
+ return view('users', ['usersCount' => $usersCount]);
}
// Task 2. Change the View code so alert would not show on the screen
diff --git a/resources/views/alert.blade.php b/resources/views/alert.blade.php
index 68bf0b9d..49ed1ff2 100644
--- a/resources/views/alert.blade.php
+++ b/resources/views/alert.blade.php
@@ -9,10 +9,12 @@
- {!! $text !!}
- Your task is to change the code of alert.blade.php, to avoid that JavaScript alert.
+ @guest
+ {{ $text }}
+ Your task is to change the code of alert.blade.php, to avoid that JavaScript alert.
+ @endguest
-
+
\ No newline at end of file
diff --git a/resources/views/authenticated.blade.php b/resources/views/authenticated.blade.php
index e200ae1e..065585a3 100644
--- a/resources/views/authenticated.blade.php
+++ b/resources/views/authenticated.blade.php
@@ -10,9 +10,13 @@
{{-- Task: add a condition to show correct text --}}
+ @auth
{{-- If user is logged in, show their email --}}
- Yes, I am logged in as [insert_user_email_here].
- No, I am not logged in.
+ Yes, I am logged in as {{ Auth::user()->email }}.
+ @else
+ {{-- If user is not logged in, show a different message --}}
+ No, I am not logged in.
+ @endauth
{{-- Task: include file resources/views/includes/row.blade.php --}}
{{-- passing the $user variable to it --}}
+ @include('includes.row', ['user' => $user])
-
+@endsection
\ No newline at end of file
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php
index 9da21478..f0051760 100644
--- a/resources/views/layouts/app.blade.php
+++ b/resources/views/layouts/app.blade.php
@@ -5,8 +5,8 @@
- {{-- Task: edit one file to pass $metaTitle as "Blade Test" to all views --}}
- {{ $metaTitle ?? 'Laravel' }}
+ {{-- Task: edit one file to pass $metaTitle as "Blade Test" to all views --}}
+ {{ $metaTitle ?? 'Blade Test' }}
diff --git a/resources/views/rows.blade.php b/resources/views/rows.blade.php
index 4762a090..43a4b65b 100644
--- a/resources/views/rows.blade.php
+++ b/resources/views/rows.blade.php
@@ -21,11 +21,12 @@
@foreach ($users as $user)
{{-- Task: only every second row should have "bg-red-100" --}}
-
-
{{-- Task: add row number here: 1, 2, etc. --}}
-
{{ $user->name }}
+
$loop->index % 2 == 0])>
+ {{-- Task: add the loop here to show users, or the row "No content" --}}
+
{{ $loop->index + 1 }}
+
{{ $user->name }}
{{-- Task: only the FIRST row should have email with "font-bold" --}}
-
{{ $user->email }}
+
$loop->first])> {{ $user->email }}
{{ $user->created_at }}
@endforeach
diff --git a/resources/views/table.blade.php b/resources/views/table.blade.php
index 399bf5c0..eee6304f 100644
--- a/resources/views/table.blade.php
+++ b/resources/views/table.blade.php
@@ -20,13 +20,17 @@
{{-- Task: add the loop here to show users, or the row "No content" --}}