Commit 21f626f6 by hfpp2012 yinsigan

第一个路由 UsersController

1 parent 1a954577
......@@ -10,14 +10,15 @@ class UsersController extends Controller
{
$users = [
'0' => [
'first_name' => 'a',
'last_name' => 'b'
'first_name' => 'Renato',
'last_name' => 'Hysa'
],
'1' => [
'first_name' => 'c',
'last_name' => 'd'
'first_name' => 'Jessica',
'last_name' => 'Alba'
]
];
return $users;
// return $users;
return view('admin.users.index', compact('users'));
}
}
<ul>
@foreach($users as $user)
<li>{!! $user['first_name'] !!} {!! $user['last_name'] !!}</li>
@endforeach
</ul>
......@@ -15,16 +15,18 @@ Route::get('/', function () {
return view('welcome');
});
Route::get('/users', function () {
$users = [
'0' => [
'first_name' => 'a',
'last_name' => 'b'
],
'1' => [
'first_name' => 'c',
'last_name' => 'd'
]
];
return $users;
});
// Route::get('/users', function () {
// $users = [
// '0' => [
// 'first_name' => 'a',
// 'last_name' => 'b'
// ],
// '1' => [
// 'first_name' => 'c',
// 'last_name' => 'd'
// ]
// ];
// return $users;
// });
Route::get('/users', ['uses' => 'UsersController@index']);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!