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
@@ -11,7 +11,7 @@ class HomeController extends Controller
{
$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
Generated
+1460 -1153
View File
File diff suppressed because it is too large Load Diff
+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>
+25 -25
View File
@@ -11,54 +11,54 @@ use App\Http\Controllers\Auth\VerifyEmailController;
use Illuminate\Support\Facades\Route;
Route::get('/register', [RegisteredUserController::class, 'create'])
->middleware('guest')
->name('register');
->middleware('guest')
->name('register');
Route::post('/register', [RegisteredUserController::class, 'store'])
->middleware('guest');
->middleware('guest');
Route::get('/login', [AuthenticatedSessionController::class, 'create'])
->middleware('guest')
->name('login');
->middleware('guest')
->name('login');
Route::post('/login', [AuthenticatedSessionController::class, 'store'])
->middleware('guest');
->middleware('guest');
Route::get('/forgot-password', [PasswordResetLinkController::class, 'create'])
->middleware('guest')
->name('password.request');
->middleware('guest')
->name('password.request');
Route::post('/forgot-password', [PasswordResetLinkController::class, 'store'])
->middleware('guest')
->name('password.email');
->middleware('guest')
->name('password.email');
Route::get('/reset-password/{token}', [NewPasswordController::class, 'create'])
->middleware('guest')
->name('password.reset');
->middleware('guest')
->name('password.reset');
Route::post('/reset-password', [NewPasswordController::class, 'store'])
->middleware('guest')
->name('password.update');
->middleware('guest')
->name('password.update');
Route::get('/verify-email', [EmailVerificationPromptController::class, '__invoke'])
->middleware('auth')
->name('verification.notice');
->middleware('auth')
->name('verification.notice');
Route::get('/verify-email/{id}/{hash}', [VerifyEmailController::class, '__invoke'])
->middleware(['auth', 'signed', 'throttle:6,1'])
->name('verification.verify');
->middleware(['auth', 'signed', 'throttle:6,1'])
->name('verification.verify');
Route::post('/email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
->middleware(['auth', 'throttle:6,1'])
->name('verification.send');
->middleware(['auth', 'throttle:6,1'])
->name('verification.send');
Route::get('/confirm-password', [ConfirmablePasswordController::class, 'show'])
->middleware('auth')
->name('password.confirm');
->middleware('auth')
->name('password.confirm');
Route::post('/confirm-password', [ConfirmablePasswordController::class, 'store'])
->middleware('auth');
->middleware('auth');
Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])
->middleware('auth')
->name('logout');
->middleware('auth')
->name('logout');
+1 -1
View File
@@ -24,4 +24,4 @@ Route::view('/authenticated', 'authenticated')->name('authenticated');
Route::get('/include', [HomeController::class, 'include'])->name('include');
Route::view('/layout', 'layout')->name('layout');
require __DIR__.'/auth.php';
require __DIR__ . '/auth.php';