Created
January 2, 2023 14:51
-
-
Save Vigowebs/ddebe03272cd2d0492513b33f36cdc33 to your computer and use it in GitHub Desktop.
This route will match a GET request to the /users URL and will call the index method of the UserController class. The index method retrieves a list of all users from the database using the User model and then returns a view file located at resources/views/users/index.blade.php, passing the $users variable to the view.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Route::get('/users', 'UserController@index'); | |
class UserController extends Controller | |
{ | |
public function index() | |
{ | |
$users = User::all(); | |
return view('users.index', compact('users')); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment