diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 3ec9546d..d8456ddd 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -4,42 +4,36 @@ use App\Models\User; -class HomeController extends Controller -{ +class HomeController extends Controller { // Task 1. Change the Controller code to pass the variable to the View - public function users() - { + public function users() { $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 - public function alert() - { + public function alert() { $text = ''; return view('alert', compact('text')); } // Task 3. Change the View code to show users, or row "No content" if 0 users - public function table() - { + public function table() { $users = User::all(); return view('table', compact('users')); } // Task 3. Change the View code to show users, or row "No content" if 0 users - public function rows() - { + public function rows() { $users = User::all(); return view('rows', compact('users')); } - public function include() - { + public function include() { $users = User::all(); return view('include', compact('users')); diff --git a/resources/views/alert.blade.php b/resources/views/alert.blade.php index 68bf0b9d..2980b456 100644 --- a/resources/views/alert.blade.php +++ b/resources/views/alert.blade.php @@ -9,7 +9,7 @@