From 6f5adea38090cd90aa21b751ed3feed7c5f4c1b9 Mon Sep 17 00:00:00 2001 From: spareparts23 <61853576+spareparts23@users.noreply.github.com> Date: Wed, 8 Nov 2023 14:48:13 -0800 Subject: [PATCH] completed changes test completed --- app/Providers/AppServiceProvider.php | 2 +- resources/views/alert.blade.php | 2 +- resources/views/authenticated.blade.php | 7 ++++++- resources/views/include.blade.php | 1 + resources/views/layout.blade.php | 7 +++++-- resources/views/rows.blade.php | 7 ++++++- resources/views/table.blade.php | 4 ++++ routes/web.php | 1 - 8 files changed, 24 insertions(+), 7 deletions(-) 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'); } } diff --git a/resources/views/alert.blade.php b/resources/views/alert.blade.php index 68bf0b9d..11873911 100644 --- a/resources/views/alert.blade.php +++ b/resources/views/alert.blade.php @@ -9,7 +9,7 @@
- {!! $text !!} + {{$text}} Your task is to change the code of alert.blade.php, to avoid that JavaScript alert.
diff --git a/resources/views/authenticated.blade.php b/resources/views/authenticated.blade.php index e200ae1e..74898d54 100644 --- a/resources/views/authenticated.blade.php +++ b/resources/views/authenticated.blade.php @@ -1,3 +1,4 @@ +@php use App\Models\User; @endphp

@@ -11,8 +12,12 @@
{{-- 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()->user()) + + Yes, I am logged in as {{ auth()->user()->email }} + @else No, I am not logged in. + @endif

diff --git a/resources/views/include.blade.php b/resources/views/include.blade.php index 95d9bd6c..ec57c6e2 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] ) @endforeach diff --git a/resources/views/layout.blade.php b/resources/views/layout.blade.php index f8ffc5b6..5e11e8c7 100644 --- a/resources/views/layout.blade.php +++ b/resources/views/layout.blade.php @@ -1,4 +1,6 @@ - +@extends('layouts.main') + +@section('content')
@@ -10,4 +12,5 @@
-
+ +@endsection diff --git a/resources/views/rows.blade.php b/resources/views/rows.blade.php index 4762a090..a207d0cf 100644 --- a/resources/views/rows.blade.php +++ b/resources/views/rows.blade.php @@ -21,11 +21,16 @@ @foreach ($users as $user) {{-- Task: only every second row should have "bg-red-100" --}} + @if ($loop->even) - {{-- Task: add row number here: 1, 2, etc. --}} + @endif + {{$loop->index}} {{ $user->name }} + {{-- Task: only the FIRST row should have email with "font-bold" --}} + @if($loop->first) {{ $user->email }} + @endif {{ $user->created_at }} @endforeach diff --git a/resources/views/table.blade.php b/resources/views/table.blade.php index 399bf5c0..b73f3cf4 100644 --- a/resources/views/table.blade.php +++ b/resources/views/table.blade.php @@ -19,14 +19,18 @@ {{-- Task: add the loop here to show users, or the row "No content" --}} + @forelse($users as $user) {{ $user->name }} {{ $user->email }} {{ $user->created_at }} + @empty No content. + @endforelse + diff --git a/routes/web.php b/routes/web.php index 7b85d1a9..f36701f8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -15,7 +15,6 @@ */ Route::view('/', 'dashboard')->name('dashboard'); - Route::get('/users', [HomeController::class, 'users'])->name('users'); Route::get('/alert', [HomeController::class, 'alert'])->name('alert'); Route::get('/table', [HomeController::class, 'table'])->name('table');