Skip to content

Commit

Permalink
completed changes
Browse files Browse the repository at this point in the history
test completed
  • Loading branch information
spareparts23 committed Nov 8, 2023
1 parent 8a14465 commit 6f5adea
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public function register()
*/
public function boot()
{
//
view()->share('metaTitle', 'Blade Test');
}
}
2 changes: 1 addition & 1 deletion resources/views/alert.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
7 changes: 6 additions & 1 deletion resources/views/authenticated.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@php use App\Models\User; @endphp
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
Expand All @@ -11,8 +12,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].
@if(auth()->user())

Yes, I am logged in as {{ auth()->user()->email }}
@else
No, I am not logged in.
@endif
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions resources/views/include.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<tr class="bg-red-100">
{{-- Task: include file resources/views/includes/row.blade.php --}}
{{-- passing the $user variable to it --}}
@include('includes.row', [$user] )
</tr>
@endforeach
</tbody>
Expand Down
7 changes: 5 additions & 2 deletions resources/views/layout.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<x-app-layout>
@extends('layouts.main')

@section('content')
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
Expand All @@ -10,4 +12,5 @@
</div>
</div>
</div>
</x-app-layout>

@endsection
7 changes: 6 additions & 1 deletion resources/views/rows.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@
<tbody>
@foreach ($users as $user)
{{-- Task: only every second row should have "bg-red-100" --}}
@if ($loop->even)
<tr class="bg-red-100">
<td>{{-- Task: add row number here: 1, 2, etc. --}}</td>
@endif
<td>{{$loop->index}}</td>
<td>{{ $user->name }}</td>

{{-- Task: only the FIRST row should have email with "font-bold" --}}
@if($loop->first)
<td class="font-bold">{{ $user->email }}</td>
@endif
<td>{{ $user->created_at }}</td>
</tr>
@endforeach
Expand Down
4 changes: 4 additions & 0 deletions resources/views/table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@
</thead>
{{-- Task: add the loop here to show users, or the row "No content" --}}
<tbody>
@forelse($users as $user)
<tr>
<td>{{ $user->name }}</td>
<td>{{ $user->email }}</td>
<td>{{ $user->created_at }}</td>
</tr>
@empty
<tr>
<td colspan="3">No content.</td>
</tr>
@endforelse

</tbody>
</table>
</div>
Expand Down
1 change: 0 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

1 comment on commit 6f5adea

@spareparts23
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Laravel-Test-Blade-Basics

Please sign in to comment.