mirror of
https://github.com/10h30/Test-Laravel-Blade-Basics.git
synced 2026-06-05 15:07:44 +09:00
Complete task 5
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user