質問編集履歴
3
追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -61,7 +61,82 @@
|
|
61
61
|
| | GET|HEAD | tags/{tag}/edit | tags.edit | App\Http\Controllers\TagsController@edit
|
62
62
|
| web |
|
63
63
|
```
|
64
|
+
RegisterController.php
|
65
|
+
```
|
66
|
+
<?php
|
64
67
|
|
68
|
+
namespace App\Http\Controllers\Auth;
|
69
|
+
|
70
|
+
use App\User;
|
71
|
+
use App\Http\Controllers\Controller;
|
72
|
+
use Illuminate\Support\Facades\Hash;
|
73
|
+
use Illuminate\Support\Facades\Validator;
|
74
|
+
use Illuminate\Foundation\Auth\RegistersUsers;
|
75
|
+
|
76
|
+
class RegisterController extends Controller
|
77
|
+
{
|
78
|
+
/*
|
79
|
+
|--------------------------------------------------------------------------
|
80
|
+
| Register Controller
|
81
|
+
|--------------------------------------------------------------------------
|
82
|
+
|
|
83
|
+
| This controller handles the registration of new users as well as their
|
84
|
+
| validation and creation. By default this controller uses a trait to
|
85
|
+
| provide this functionality without requiring any additional code.
|
86
|
+
|
|
87
|
+
*/
|
88
|
+
|
89
|
+
use RegistersUsers;
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Where to redirect users after registration.
|
93
|
+
*
|
94
|
+
* @var string
|
95
|
+
*/
|
96
|
+
protected $redirectTo = '/home';
|
97
|
+
|
98
|
+
/**
|
99
|
+
* Create a new controller instance.
|
100
|
+
*
|
101
|
+
* @return void
|
102
|
+
*/
|
103
|
+
public function __construct()
|
104
|
+
{
|
105
|
+
$this->middleware('guest');
|
106
|
+
}
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Get a validator for an incoming registration request.
|
110
|
+
*
|
111
|
+
* @param array $data
|
112
|
+
* @return \Illuminate\Contracts\Validation\Validator
|
113
|
+
*/
|
114
|
+
protected function validator(array $data)
|
115
|
+
{
|
116
|
+
return Validator::make($data, [
|
117
|
+
'name' => ['required', 'string', 'max:255'],
|
118
|
+
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
119
|
+
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
120
|
+
]);
|
121
|
+
}
|
122
|
+
|
123
|
+
/**
|
124
|
+
* Create a new user instance after a valid registration.
|
125
|
+
*
|
126
|
+
* @param array $data
|
127
|
+
* @return \App\User
|
128
|
+
*/
|
129
|
+
protected function create(array $data)
|
130
|
+
{
|
131
|
+
return User::create([
|
132
|
+
'name' => $data['name'],
|
133
|
+
'email' => $data['email'],
|
134
|
+
'password' => Hash::make($data['password']),
|
135
|
+
]);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
```
|
139
|
+
|
65
140
|
追記
|
66
141
|
php artisan make:authコマンドで追加されたApp\Http\Controllers\Auth\RegisterController@showRegistrationForm
|
67
142
|
があって、RegisterControllerのshowRegistrationFormアクションにテンプレートへ送るデータを追加したいのですが、
|
2
追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -60,4 +60,9 @@
|
|
60
60
|
| web |
|
61
61
|
| | GET|HEAD | tags/{tag}/edit | tags.edit | App\Http\Controllers\TagsController@edit
|
62
62
|
| web |
|
63
|
-
```
|
63
|
+
```
|
64
|
+
|
65
|
+
追記
|
66
|
+
php artisan make:authコマンドで追加されたApp\Http\Controllers\Auth\RegisterController@showRegistrationForm
|
67
|
+
があって、RegisterControllerのshowRegistrationFormアクションにテンプレートへ送るデータを追加したいのですが、
|
68
|
+
showRegistrationFormアクションが見つけられません。どうやって送ればいいのでしょうか?
|
1
追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,4 +7,57 @@
|
|
7
7
|
$a = [1,2,3,4]
|
8
8
|
return view('~~~', ['a' => $a]);
|
9
9
|
}
|
10
|
+
```
|
11
|
+
php artisan route:list
|
12
|
+
```
|
13
|
+
| GET|HEAD | api/user | | Closure
|
14
|
+
| api,auth:api |
|
15
|
+
| | GET|HEAD | articles | articles.index | App\Http\Controllers\ArticlesController@index
|
16
|
+
| web |
|
17
|
+
| | POST | articles | articles.store | App\Http\Controllers\ArticlesController@store
|
18
|
+
| web |
|
19
|
+
| | GET|HEAD | articles/create | articles.create | App\Http\Controllers\ArticlesController@create
|
20
|
+
| web |
|
21
|
+
| | GET|HEAD | articles/{article} | articles.show | App\Http\Controllers\ArticlesController@show
|
22
|
+
| web |
|
23
|
+
| | PUT|PATCH | articles/{article} | articles.update | App\Http\Controllers\ArticlesController@update
|
24
|
+
| web |
|
25
|
+
| | DELETE | articles/{article} | articles.destroy | App\Http\Controllers\ArticlesController@destroy
|
26
|
+
| web |
|
27
|
+
| | GET|HEAD | articles/{article}/edit | articles.edit | App\Http\Controllers\ArticlesController@edit
|
28
|
+
| web |
|
29
|
+
| | GET|HEAD | home | home | App\Http\Controllers\HomeController@index
|
30
|
+
| web,auth |
|
31
|
+
| | GET|HEAD | login | login | App\Http\Controllers\Auth\LoginController@showLoginForm
|
32
|
+
| web,guest |
|
33
|
+
| | POST | login | | App\Http\Controllers\Auth\LoginController@login
|
34
|
+
| web,guest |
|
35
|
+
| | POST | logout | logout | App\Http\Controllers\Auth\LoginController@logout
|
36
|
+
| web |
|
37
|
+
| | POST | password/email | password.email | App\Http\Controllers\Auth\ForgotPasswordController@sendResetLinkEmail
|
38
|
+
| web,guest |
|
39
|
+
| | GET|HEAD | password/reset | password.request | App\Http\Controllers\Auth\ForgotPasswordController@showLinkRequestForm
|
40
|
+
| web,guest |
|
41
|
+
| | POST | password/reset | password.update | App\Http\Controllers\Auth\ResetPasswordController@reset
|
42
|
+
| web,guest |
|
43
|
+
| | GET|HEAD | password/reset/{token} | password.reset | App\Http\Controllers\Auth\ResetPasswordController@showResetForm
|
44
|
+
| web,guest |
|
45
|
+
| | GET|HEAD | register | register | App\Http\Controllers\Auth\RegisterController@showRegistrationForm
|
46
|
+
| web,guest |
|
47
|
+
| | POST | register | | App\Http\Controllers\Auth\RegisterController@register
|
48
|
+
| web,guest |
|
49
|
+
| | POST | tags | tags.store | App\Http\Controllers\TagsController@store
|
50
|
+
| web |
|
51
|
+
| | GET|HEAD | tags | tags.index | App\Http\Controllers\TagsController@index
|
52
|
+
| web |
|
53
|
+
| | GET|HEAD | tags/create | tags.create | App\Http\Controllers\TagsController@create
|
54
|
+
| web |
|
55
|
+
| | GET|HEAD | tags/{tag} | tags.show | App\Http\Controllers\TagsController@show
|
56
|
+
| web |
|
57
|
+
| | PUT|PATCH | tags/{tag} | tags.update | App\Http\Controllers\TagsController@update
|
58
|
+
| web |
|
59
|
+
| | DELETE | tags/{tag} | tags.destroy | App\Http\Controllers\TagsController@destroy
|
60
|
+
| web |
|
61
|
+
| | GET|HEAD | tags/{tag}/edit | tags.edit | App\Http\Controllers\TagsController@edit
|
62
|
+
| web |
|
10
63
|
```
|