Skip to content

Commit 5710bd0

Browse files
committed
finish user signup
1 parent 9093d46 commit 5710bd0

File tree

14 files changed

+381
-61
lines changed

14 files changed

+381
-61
lines changed

app/Http/Controllers/UsersController.php

+25
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,35 @@
22

33
namespace App\Http\Controllers;
44

5+
use App\Models\User;
6+
use Illuminate\Http\Request;
7+
58
class UsersController extends Controller
69
{
710
public function create()
811
{
912
return view('users.create');
1013
}
14+
15+
public function show(User $user)
16+
{
17+
return view('users.show', compact('user'));
18+
}
19+
20+
public function store(Request $request)
21+
{
22+
$this->validate($request, [
23+
'name' => 'required|max:50',
24+
'email' => 'required|email|unique:users|max:255',
25+
'password' => 'required|confirmed|min:6',
26+
]);
27+
28+
$user = User::create([
29+
'name' => $request->name,
30+
'email' => $request->email,
31+
'password' => bcrypt($request->password),
32+
]);
33+
session()->flash('success', 'welcome,you will have a new journal');
34+
return redirect()->route('users.show', [$user]);
35+
}
1136
}

app/Models/User.php

+5
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,9 @@ class User extends Authenticatable
2626
protected $hidden = [
2727
'password', 'remember_token',
2828
];
29+
public function gravatar($size = '100')
30+
{
31+
$hash = md5(strtolower(trim($this->attributes['email'])));
32+
return "http://www.gravatar.com/avatar/$hash?s=$size";
33+
}
2934
}

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"php": ">=7.0.0",
99
"fideloper/proxy": "~3.3",
1010
"laravel/framework": "5.5.*",
11-
"laravel/tinker": "~1.0"
11+
"laravel/tinker": "~1.0",
12+
"overtrue/laravel-lang": "~3.0"
1213
},
1314
"require-dev": {
1415
"filp/whoops": "~2.0",

composer.lock

+106-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/app.php

+57-57
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
| framework needs to place the application's name in a notification or
1212
| any other location as required by the application or its packages.
1313
|
14-
*/
14+
*/
1515

16-
'name' => env('APP_NAME', 'Laravel'),
16+
'name' => env('APP_NAME', 'Laravel'),
1717

1818
/*
1919
|--------------------------------------------------------------------------
@@ -24,9 +24,9 @@
2424
| running in. This may determine how you prefer to configure various
2525
| services your application utilizes. Set this in your ".env" file.
2626
|
27-
*/
27+
*/
2828

29-
'env' => env('APP_ENV', 'production'),
29+
'env' => env('APP_ENV', 'production'),
3030

3131
/*
3232
|--------------------------------------------------------------------------
@@ -37,9 +37,9 @@
3737
| stack traces will be shown on every error that occurs within your
3838
| application. If disabled, a simple generic error page is shown.
3939
|
40-
*/
40+
*/
4141

42-
'debug' => env('APP_DEBUG', false),
42+
'debug' => env('APP_DEBUG', false),
4343

4444
/*
4545
|--------------------------------------------------------------------------
@@ -50,9 +50,9 @@
5050
| the Artisan command line tool. You should set this to the root of
5151
| your application so that it is used when running Artisan tasks.
5252
|
53-
*/
53+
*/
5454

55-
'url' => env('APP_URL', 'http://localhost'),
55+
'url' => env('APP_URL', 'http://localhost'),
5656

5757
/*
5858
|--------------------------------------------------------------------------
@@ -63,9 +63,9 @@
6363
| will be used by the PHP date and date-time functions. We have gone
6464
| ahead and set this to a sensible default for you out of the box.
6565
|
66-
*/
66+
*/
6767

68-
'timezone' => 'UTC',
68+
'timezone' => 'UTC',
6969

7070
/*
7171
|--------------------------------------------------------------------------
@@ -76,9 +76,9 @@
7676
| by the translation service provider. You are free to set this value
7777
| to any of the locales which will be supported by the application.
7878
|
79-
*/
79+
*/
8080

81-
'locale' => 'en',
81+
'locale' => 'zh-CN',
8282

8383
/*
8484
|--------------------------------------------------------------------------
@@ -89,7 +89,7 @@
8989
| is not available. You may change the value to correspond to any of
9090
| the language folders that are provided through your application.
9191
|
92-
*/
92+
*/
9393

9494
'fallback_locale' => 'en',
9595

@@ -102,11 +102,11 @@
102102
| to a random, 32 character string, otherwise these encrypted strings
103103
| will not be safe. Please do this before deploying an application!
104104
|
105-
*/
105+
*/
106106

107-
'key' => env('APP_KEY'),
107+
'key' => env('APP_KEY'),
108108

109-
'cipher' => 'AES-256-CBC',
109+
'cipher' => 'AES-256-CBC',
110110

111111
/*
112112
|--------------------------------------------------------------------------
@@ -119,11 +119,11 @@
119119
|
120120
| Available Settings: "single", "daily", "syslog", "errorlog"
121121
|
122-
*/
122+
*/
123123

124-
'log' => env('APP_LOG', 'single'),
124+
'log' => env('APP_LOG', 'single'),
125125

126-
'log_level' => env('APP_LOG_LEVEL', 'debug'),
126+
'log_level' => env('APP_LOG_LEVEL', 'debug'),
127127

128128
/*
129129
|--------------------------------------------------------------------------
@@ -134,9 +134,9 @@
134134
| request to your application. Feel free to add your own services to
135135
| this array to grant expanded functionality to your applications.
136136
|
137-
*/
137+
*/
138138

139-
'providers' => [
139+
'providers' => [
140140

141141
/*
142142
* Laravel Framework Service Providers...
@@ -188,43 +188,43 @@
188188
| is started. However, feel free to register as many as you wish as
189189
| the aliases are "lazy" loaded so they don't hinder performance.
190190
|
191-
*/
192-
193-
'aliases' => [
194-
195-
'App' => Illuminate\Support\Facades\App::class,
196-
'Artisan' => Illuminate\Support\Facades\Artisan::class,
197-
'Auth' => Illuminate\Support\Facades\Auth::class,
198-
'Blade' => Illuminate\Support\Facades\Blade::class,
199-
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
200-
'Bus' => Illuminate\Support\Facades\Bus::class,
201-
'Cache' => Illuminate\Support\Facades\Cache::class,
202-
'Config' => Illuminate\Support\Facades\Config::class,
203-
'Cookie' => Illuminate\Support\Facades\Cookie::class,
204-
'Crypt' => Illuminate\Support\Facades\Crypt::class,
205-
'DB' => Illuminate\Support\Facades\DB::class,
206-
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
207-
'Event' => Illuminate\Support\Facades\Event::class,
208-
'File' => Illuminate\Support\Facades\File::class,
209-
'Gate' => Illuminate\Support\Facades\Gate::class,
210-
'Hash' => Illuminate\Support\Facades\Hash::class,
211-
'Lang' => Illuminate\Support\Facades\Lang::class,
212-
'Log' => Illuminate\Support\Facades\Log::class,
213-
'Mail' => Illuminate\Support\Facades\Mail::class,
191+
*/
192+
193+
'aliases' => [
194+
195+
'App' => Illuminate\Support\Facades\App::class,
196+
'Artisan' => Illuminate\Support\Facades\Artisan::class,
197+
'Auth' => Illuminate\Support\Facades\Auth::class,
198+
'Blade' => Illuminate\Support\Facades\Blade::class,
199+
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
200+
'Bus' => Illuminate\Support\Facades\Bus::class,
201+
'Cache' => Illuminate\Support\Facades\Cache::class,
202+
'Config' => Illuminate\Support\Facades\Config::class,
203+
'Cookie' => Illuminate\Support\Facades\Cookie::class,
204+
'Crypt' => Illuminate\Support\Facades\Crypt::class,
205+
'DB' => Illuminate\Support\Facades\DB::class,
206+
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
207+
'Event' => Illuminate\Support\Facades\Event::class,
208+
'File' => Illuminate\Support\Facades\File::class,
209+
'Gate' => Illuminate\Support\Facades\Gate::class,
210+
'Hash' => Illuminate\Support\Facades\Hash::class,
211+
'Lang' => Illuminate\Support\Facades\Lang::class,
212+
'Log' => Illuminate\Support\Facades\Log::class,
213+
'Mail' => Illuminate\Support\Facades\Mail::class,
214214
'Notification' => Illuminate\Support\Facades\Notification::class,
215-
'Password' => Illuminate\Support\Facades\Password::class,
216-
'Queue' => Illuminate\Support\Facades\Queue::class,
217-
'Redirect' => Illuminate\Support\Facades\Redirect::class,
218-
'Redis' => Illuminate\Support\Facades\Redis::class,
219-
'Request' => Illuminate\Support\Facades\Request::class,
220-
'Response' => Illuminate\Support\Facades\Response::class,
221-
'Route' => Illuminate\Support\Facades\Route::class,
222-
'Schema' => Illuminate\Support\Facades\Schema::class,
223-
'Session' => Illuminate\Support\Facades\Session::class,
224-
'Storage' => Illuminate\Support\Facades\Storage::class,
225-
'URL' => Illuminate\Support\Facades\URL::class,
226-
'Validator' => Illuminate\Support\Facades\Validator::class,
227-
'View' => Illuminate\Support\Facades\View::class,
215+
'Password' => Illuminate\Support\Facades\Password::class,
216+
'Queue' => Illuminate\Support\Facades\Queue::class,
217+
'Redirect' => Illuminate\Support\Facades\Redirect::class,
218+
'Redis' => Illuminate\Support\Facades\Redis::class,
219+
'Request' => Illuminate\Support\Facades\Request::class,
220+
'Response' => Illuminate\Support\Facades\Response::class,
221+
'Route' => Illuminate\Support\Facades\Route::class,
222+
'Schema' => Illuminate\Support\Facades\Schema::class,
223+
'Session' => Illuminate\Support\Facades\Session::class,
224+
'Storage' => Illuminate\Support\Facades\Storage::class,
225+
'URL' => Illuminate\Support\Facades\URL::class,
226+
'Validator' => Illuminate\Support\Facades\Validator::class,
227+
'View' => Illuminate\Support\Facades\View::class,
228228

229229
],
230230

0 commit comments

Comments
 (0)