diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index 3ec9546d..8aec84ea 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -11,15 +11,15 @@ 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
public function alert()
{
- $text = '';
+ // $text = '';
- return view('alert', compact('text'));
+ return view('alert');
}
// Task 3. Change the View code to show users, or row "No content" if 0 users
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index 38c135bd..9d30f522 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -24,6 +24,9 @@ public function register()
*/
public function boot()
{
- //
+ View::composer('*', function ($view) {
+ // You can set your global meta title here
+ $view->with('metaTitle', 'Blade Test');
+ });
}
}
diff --git a/resources/views/alert.blade.php b/resources/views/alert.blade.php
index 68bf0b9d..f2e3095e 100644
--- a/resources/views/alert.blade.php
+++ b/resources/views/alert.blade.php
@@ -1,15 +1,14 @@
-
+
{{ __('Security alert') }}
-
-
+
+
- {!! $text !!}
Your task is to change the code of alert.blade.php, to avoid that JavaScript alert.
{{-- 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].
+ @if(!Auth::check())
No, I am not logged in.
+ @else
+ Yes, I am logged in as {{ Auth::user()->email }}.
+ @endif
+