Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
hfpp2012
/
laravel-blog
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 21f626f6
authored
Aug 03, 2017
by
hfpp2012 yinsigan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
第一个路由 UsersController
1 parent
1a954577
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
18 deletions
app/Http/Controllers/UsersController.php
resources/views/admin/users/index.blade.php
routes/web.php
app/Http/Controllers/UsersController.php
View file @
21f626f
...
@@ -10,14 +10,15 @@ class UsersController extends Controller
...
@@ -10,14 +10,15 @@ class UsersController extends Controller
{
{
$users
=
[
$users
=
[
'0'
=>
[
'0'
=>
[
'first_name'
=>
'
a
'
,
'first_name'
=>
'
Renato
'
,
'last_name'
=>
'
b
'
'last_name'
=>
'
Hysa
'
],
],
'1'
=>
[
'1'
=>
[
'first_name'
=>
'
c
'
,
'first_name'
=>
'
Jessica
'
,
'last_name'
=>
'
d
'
'last_name'
=>
'
Alba
'
]
]
];
];
return
$users
;
// return $users;
return
view
(
'admin.users.index'
,
compact
(
'users'
));
}
}
}
}
resources/views/admin/users/index.blade.php
0 → 100644
View file @
21f626f
<ul>
@foreach($users as $user)
<li>
{!! $user['first_name'] !!} {!! $user['last_name'] !!}
</li>
@endforeach
</ul>
routes/web.php
View file @
21f626f
...
@@ -15,16 +15,18 @@ Route::get('/', function () {
...
@@ -15,16 +15,18 @@ Route::get('/', function () {
return
view
(
'welcome'
);
return
view
(
'welcome'
);
});
});
Route
::
get
(
'/users'
,
function
()
{
// Route::get('/users', function () {
$users
=
[
// $users = [
'0'
=>
[
// '0' => [
'first_name'
=>
'a'
,
// 'first_name' => 'a',
'last_name'
=>
'b'
// 'last_name' => 'b'
],
// ],
'1'
=>
[
// '1' => [
'first_name'
=>
'c'
,
// 'first_name' => 'c',
'last_name'
=>
'd'
// 'last_name' => 'd'
]
// ]
];
// ];
return
$users
;
// return $users;
});
// });
Route
::
get
(
'/users'
,
[
'uses'
=>
'UsersController@index'
]);
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment