Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bc39ae6

Browse files
Finish user signup
1 parent 0ec7dc0 commit bc39ae6

File tree

19 files changed

+467
-6
lines changed

19 files changed

+467
-6
lines changed

‎app/Http/Controllers/UsersController.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,36 @@
77
use App\Http\Requests;
88
use App\Http\Controllers\Controller;
99

10+
use App\Models\User;
11+
1012
class UsersController extends Controller
1113
{
1214
public function create()
1315
{
1416
return view('users.create');
1517
}
18+
19+
public function show($id)
20+
{
21+
$user = User::findOrFail($id);
22+
return view('users.show', compact('user'));
23+
}
24+
25+
public function store(Request $request)
26+
{
27+
$this->validate($request, [
28+
'name' => 'required|max:50',
29+
'email' => 'required|email|unique:users|max:255',
30+
'password' => 'required|confirmed|min:6'
31+
]);
32+
33+
$user = User::create([
34+
'name' => $request->name,
35+
'email' => $request->email,
36+
'password' => $request->password,
37+
]);
38+
39+
session()->flash('success', '欢迎,您将在这里开启一段新的旅程~');
40+
return redirect()->route('users.show', [$user]);
41+
}
1642
}

‎app/Http/routes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
get('/about', 'StaticPagesController@about')->name('about');
66

77
get('signup', 'UsersController@create')->name('signup');
8+
resource('users', 'UsersController');

‎app/Models/User.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,15 @@ class User extends Model implements AuthenticatableContract,
3636
* @var array
3737
*/
3838
protected $hidden = ['password', 'remember_token'];
39+
40+
public function gravatar($size = '100')
41+
{
42+
$hash = md5(strtolower(trim($this->attributes['email'])));
43+
return "http://www.gravatar.com/avatar/$hash?s=$size";
44+
}
45+
46+
public function setPasswordAttribute($password)
47+
{
48+
$this->attributes['password'] = bcrypt($password);
49+
}
3950
}

‎composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"type": "project",
77
"require": {
88
"php": ">=5.5.9",
9-
"laravel/framework": "5.1.*"
9+
"laravel/framework": "5.1.*",
10+
"caouecs/laravel-lang": "~3.0"
1011
},
1112
"require-dev": {
1213
"fzaninotto/faker": "~1.4",

‎composer.lock

Lines changed: 42 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎config/app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
|
5353
*/
5454

55-
'locale' => 'en',
55+
'locale' => 'zh-CN',
5656

5757
/*
5858
|--------------------------------------------------------------------------

‎public/css/app.css

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎public/css/app.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎resources/assets/sass/app.scss

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,60 @@ footer ul li {
9797
float: left;
9898
margin-left: 15px;
9999
}
100+
101+
/* sidebar */
102+
103+
aside {
104+
section {
105+
padding: 10px 0;
106+
margin-top: 20px;
107+
&:first-child {
108+
border: 0;
109+
padding-top: 0;
110+
}
111+
span {
112+
display: block;
113+
margin-bottom: 3px;
114+
line-height: 1;
115+
}
116+
}
117+
}
118+
119+
section.user_info {
120+
padding-bottom: 10px;
121+
margin-top: 20px;
122+
text-align: center;
123+
.gravatar {
124+
float: none;
125+
max-width: 70px;
126+
}
127+
h1 {
128+
font-size: 1.4em;
129+
letter-spacing: -1px;
130+
margin-bottom: 3px;
131+
margin-top: 15px;
132+
}
133+
}
134+
135+
.gravatar {
136+
float: left;
137+
margin-right: 10px;
138+
max-width: 50px;
139+
border-radius: 50%;
140+
}
141+
142+
/* forms */
143+
144+
input, textarea, select, .uneditable-input {
145+
border: 1px solid #bbb;
146+
width: 100%;
147+
margin-bottom: 15px;
148+
}
149+
150+
input {
151+
height: auto !important;
152+
}
153+
154+
.panel {
155+
margin-top: 50px;
156+
}

‎resources/lang/zh-CN/auth.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Authentication Language Lines
8+
|--------------------------------------------------------------------------
9+
|
10+
| The following language lines are used during authentication for various
11+
| messages that we need to display to the user. You are free to modify
12+
| these language lines according to your application's requirements.
13+
|
14+
*/
15+
16+
'failed' => '用户名或密码错误。',
17+
'throttle' => '您的尝试登录次数过多. 请 :seconds 秒后再试。',
18+
19+
];

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /