mirror of
https://github.com/10h30/Test-Laravel-Eloquent-Basics.git
synced 2026-07-11 19:05:53 +09:00
Test 2 - get data
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?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'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user