Complete task 5

This commit is contained in:
Thuan Bui
2025-04-03 10:37:47 +09:00
parent 4b534fd9d5
commit 03db7feece
8 changed files with 1511 additions and 1192 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 bg-white border-b border-gray-200">
{!! $text !!}
{{ $text }}
Your task is to change the code of alert.blade.php, to avoid that JavaScript alert.
</div>
</div>
+7 -3
View File
@@ -1,7 +1,7 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Authenticated?') }}
{{ __("Authenticated?") }}
</h2>
</x-slot>
@@ -11,8 +11,12 @@
<div class="p-6 bg-white border-b border-gray-200">
{{-- 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.
@auth
Yes, I am logged in as {{ Auth::user()->email }}.
@endauth
@guest
No, I am not logged in.
@endguest
</div>
</div>
</div>
+8 -8
View File
@@ -20,14 +20,14 @@
</thead>
<tbody>
@foreach ($users as $user)
{{-- Task: only every second row should have "bg-red-100" --}}
<tr class="bg-red-100">
<td>{{-- Task: add row number here: 1, 2, etc. --}}</td>
<td>{{ $user->name }}</td>
{{-- Task: only the FIRST row should have email with "font-bold" --}}
<td class="font-bold">{{ $user->email }}</td>
<td>{{ $user->created_at }}</td>
</tr>
{{-- Task: only every second row should have "bg-red-100" --}}
<tr class="{{ $loop->iteration % 2 == 0 ? 'bg-red-100' : ''}}">
<td>{{ $loop->iteration}}</td>
<td>{{ $user->name }}</td>
{{-- Task: only the FIRST row should have email with "font-bold" --}}
<td class="{{ $loop->iteration == 1 ? 'font-bold' : '' }}">{{ $user->email }}</td>
<td>{{ $user->created_at }}</td>
</tr>
@endforeach
</tbody>
</table>
+8
View File
@@ -18,16 +18,24 @@
</tr>
</thead>
{{-- Task: add the loop here to show users, or the row "No content" --}}
@if (count($users) > 0)
@foreach ($users as $user )
<tbody>
<tr>
<td>{{ $user->name }}</td>
<td>{{ $user->email }}</td>
<td>{{ $user->created_at }}</td>
</tr>
</tbody>
@endforeach
@else
<tbody>
<tr>
<td colspan="3">No content.</td>
</tr>
</tbody>
@endif
</table>
</div>
</div>