2021-11-16 07:57:23 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
|
|
use App\Models\User;
|
|
|
|
|
|
|
|
|
|
class UserController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
|
|
|
|
// TASK: turn this SQL query into Eloquent
|
|
|
|
|
// select * from users
|
|
|
|
|
// where email_verified_at is not null
|
|
|
|
|
// order by created_at desc
|
|
|
|
|
// limit 3
|
|
|
|
|
|
|
|
|
|
$users = User::all(); // replace this with Eloquent statement
|
|
|
|
|
|
|
|
|
|
return view('users.index', compact('users'));
|
|
|
|
|
}
|
2021-11-16 08:05:39 +02:00
|
|
|
|
|
|
|
|
public function show($userId)
|
|
|
|
|
{
|
|
|
|
|
$user = NULL; // TASK: find user by $userId or show "404 not found" page
|
|
|
|
|
|
|
|
|
|
return view('users.show', compact('user'));
|
|
|
|
|
}
|
2021-11-16 07:57:23 +02:00
|
|
|
}
|