-
Notifications
You must be signed in to change notification settings - Fork 564
/
Copy pathHomeController.php
47 lines (35 loc) · 1.07 KB
/
HomeController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace App\Http\Controllers;
use App\Models\User;
class HomeController extends Controller
{
// Task 1. Change the Controller code to pass the variable to the View
public function users()
{
$usersCount = User::count();
return view('users', compact('usersCount'));
}
// Task 2. Change the View code so alert would not show on the screen
public function alert()
{
$text = '<script>alert("I am a security alert, your task is to remove me.");</script>';
return view('alert', compact('text'));
}
// Task 3. Change the View code to show users, or row "No content" if 0 users
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()
{
$users = User::all();
return view('rows', compact('users'));
}
public function include()
{
$users = User::all();
return view('include', compact('users'));
}
}