From 69fe2d09abe9d27cd7428af9f27c36137d6f47e8 Mon Sep 17 00:00:00 2001
From: Baraa-Darkazalli <80644482+Baraa-Darkazalli@users.noreply.github.com>
Date: Sun, 20 Oct 2024 17:10:10 +0300
Subject: [PATCH 01/10] Update HomeController.php
---
app/Http/Controllers/HomeController.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index 3ec9546d..1ea08e52 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', compact('usersCount'));
}
// Task 2. Change the View code so alert would not show on the screen
From 3fb4ea995510b33119232cbd06a86cc57740edd5 Mon Sep 17 00:00:00 2001
From: Baraa-Darkazalli <80644482+Baraa-Darkazalli@users.noreply.github.com>
Date: Sun, 20 Oct 2024 17:10:43 +0300
Subject: [PATCH 02/10] Update alert.blade.php
---
resources/views/alert.blade.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/views/alert.blade.php b/resources/views/alert.blade.php
index 68bf0b9d..9bcdca65 100644
--- a/resources/views/alert.blade.php
+++ b/resources/views/alert.blade.php
@@ -9,7 +9,7 @@
- {!! $text !!}
+ {!! htmlentities($text) !!}
Your task is to change the code of alert.blade.php, to avoid that JavaScript alert.
From 4247dd0a08d0df83b1df649e7887f5caff9485ea Mon Sep 17 00:00:00 2001
From: Baraa-Darkazalli <80644482+Baraa-Darkazalli@users.noreply.github.com>
Date: Sun, 20 Oct 2024 17:11:33 +0300
Subject: [PATCH 03/10] Update table.blade.php
---
resources/views/table.blade.php | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/resources/views/table.blade.php b/resources/views/table.blade.php
index 399bf5c0..acaa1748 100644
--- a/resources/views/table.blade.php
+++ b/resources/views/table.blade.php
@@ -19,14 +19,19 @@
{{-- Task: add the loop here to show users, or the row "No content" --}}
-
- {{ $user->name }} |
- {{ $user->email }} |
- {{ $user->created_at }} |
-
-
- No content. |
-
+ @if(!$users->isEmpty())
+ @foreach ($users as $user)
+
+ {{ $user->name }} |
+ {{ $user->email }} |
+ {{ $user->created_at }} |
+
+ @endforeach
+ @else
+
+ No content. |
+
+ @endif
From 2c73b2b0b0b34c93ce6e80b673c1ad2194dff217 Mon Sep 17 00:00:00 2001
From: Baraa-Darkazalli <80644482+Baraa-Darkazalli@users.noreply.github.com>
Date: Sun, 20 Oct 2024 17:12:03 +0300
Subject: [PATCH 04/10] Update rows.blade.php
---
resources/views/rows.blade.php | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/resources/views/rows.blade.php b/resources/views/rows.blade.php
index 4762a090..00cc3a6d 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. --}} |
+
+ {{-- Task: add row number here: 1, 2, etc. --}}
+ {{ $loop->iteration }} |
{{ $user->name }} |
{{-- Task: only the FIRST row should have email with "font-bold" --}}
- {{ $user->email }} |
+ {{ $user->email }} |
{{ $user->created_at }} |
@endforeach
From 12cf757e7702cd194b6a3b980495c3115349ddeb Mon Sep 17 00:00:00 2001
From: Baraa-Darkazalli <80644482+Baraa-Darkazalli@users.noreply.github.com>
Date: Sun, 20 Oct 2024 17:12:24 +0300
Subject: [PATCH 05/10] Update authenticated.blade.php
---
resources/views/authenticated.blade.php | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/resources/views/authenticated.blade.php b/resources/views/authenticated.blade.php
index e200ae1e..e4911949 100644
--- a/resources/views/authenticated.blade.php
+++ b/resources/views/authenticated.blade.php
@@ -11,8 +11,11 @@
{{-- Task: add a condition to show correct text --}}
{{-- If user is logged in, show their email --}}
- Yes, I am logged in as [insert_user_email_here].
- No, I am not logged in.
+ @if (Auth::check())
+ Yes, I am logged in as {{ Auth::user()->email }}.
+ @else
+ No, I am not logged in.
+ @endif
From 2ac07436a293abf1f9f3d66b58d15a9015150a2d Mon Sep 17 00:00:00 2001
From: Baraa-Darkazalli <80644482+Baraa-Darkazalli@users.noreply.github.com>
Date: Sun, 20 Oct 2024 17:14:14 +0300
Subject: [PATCH 06/10] Update AppServiceProvider.php
---
app/Providers/AppServiceProvider.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index 38c135bd..a423799e 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -24,6 +24,6 @@ public function register()
*/
public function boot()
{
- //
+ view()->share('metaTitle', 'Blade Test');
}
}
From c32b0bbdbc7e3c03b6f7948c6743dc77d0fc18f7 Mon Sep 17 00:00:00 2001
From: Baraa-Darkazalli <80644482+Baraa-Darkazalli@users.noreply.github.com>
Date: Sun, 20 Oct 2024 17:15:13 +0300
Subject: [PATCH 07/10] Update layout.blade.php
---
resources/views/layout.blade.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/resources/views/layout.blade.php b/resources/views/layout.blade.php
index f8ffc5b6..50527544 100644
--- a/resources/views/layout.blade.php
+++ b/resources/views/layout.blade.php
@@ -1,4 +1,4 @@
-
+
-
+
From bec4255239a5c8523245e6fbf598a6de24e2c040 Mon Sep 17 00:00:00 2001
From: Baraa-Darkazalli <80644482+Baraa-Darkazalli@users.noreply.github.com>
Date: Sun, 20 Oct 2024 17:21:30 +0300
Subject: [PATCH 08/10] Update layout.blade.php
---
resources/views/layout.blade.php | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/resources/views/layout.blade.php b/resources/views/layout.blade.php
index 50527544..d83c7710 100644
--- a/resources/views/layout.blade.php
+++ b/resources/views/layout.blade.php
@@ -1,13 +1,14 @@
-
+@extends('layouts.main')
+
+@section('content')
- {{-- Task: change the layout from layouts/app.blade.php --}}
- {{-- to layouts/main.blade.php --}}
- Please change layout.
+ {{-- Task: change the layout from layouts/app.blade.php to layouts/main.blade.php --}}
+ The layout has been changed to "layouts/main.blade.php".
-
+@endsection
From 9592d5e0c6eb3c17930dfba84ebdd9f5b873e156 Mon Sep 17 00:00:00 2001
From: Baraa-Darkazalli <80644482+Baraa-Darkazalli@users.noreply.github.com>
Date: Mon, 21 Oct 2024 10:09:55 +0300
Subject: [PATCH 09/10] Update include.blade.php
---
resources/views/include.blade.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/resources/views/include.blade.php b/resources/views/include.blade.php
index 95d9bd6c..f8e09b6c 100644
--- a/resources/views/include.blade.php
+++ b/resources/views/include.blade.php
@@ -21,6 +21,7 @@
{{-- Task: include file resources/views/includes/row.blade.php --}}
{{-- passing the $user variable to it --}}
+ @include('includes.row', ['user' => $user])
@endforeach
From a6c78894488395f74d1e1def35ff6644343159cc Mon Sep 17 00:00:00 2001
From: Baraa-Darkazalli <80644482+Baraa-Darkazalli@users.noreply.github.com>
Date: Mon, 21 Oct 2024 10:41:18 +0300
Subject: [PATCH 10/10] Update layout.blade.php
---
resources/views/layout.blade.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/resources/views/layout.blade.php b/resources/views/layout.blade.php
index d83c7710..ceb38905 100644
--- a/resources/views/layout.blade.php
+++ b/resources/views/layout.blade.php
@@ -5,8 +5,9 @@
- {{-- Task: change the layout from layouts/app.blade.php to layouts/main.blade.php --}}
- The layout has been changed to "layouts/main.blade.php".
+ {{-- Task: change the layout from layouts/app.blade.php --}}
+ {{-- to layouts/main.blade.php --}}
+ Please change layout.