質問編集履歴
3
画像追加
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
Laravelで新規登録後に画面遷移しない問題
|
1
|
+
Laravelで新規ユーザー登録後に画面遷移しない問題
|
body
CHANGED
@@ -334,4 +334,7 @@
|
|
334
334
|
|
335
335
|
⑤php artisan キャッシュクリア系のコマンドでキャッシュクリアしてみた
|
336
336
|
|
337
|
-
上記のことを試しても挙動が変わりませんでした。自分で調べれる限りは試してみたのですがエラーも出ていないしさっぱり原因がわかりません。他に考えうる原因はあるのでしょうか?
|
337
|
+
上記のことを試しても挙動が変わりませんでした。自分で調べれる限りは試してみたのですがエラーも出ていないしさっぱり原因がわかりません。他に考えうる原因はあるのでしょうか?
|
338
|
+
|
339
|
+
ちなみに下記画像のように遷移先のURLはGETでResponseがちゃんと返ってきています
|
340
|
+

|
2
自分で試したことを追記しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -304,4 +304,34 @@
|
|
304
304
|
}
|
305
305
|
}
|
306
306
|
</script>
|
307
|
-
```
|
307
|
+
```
|
308
|
+
|
309
|
+
|
310
|
+
**追記(試したこと)**
|
311
|
+
①RegisterController.phpの
|
312
|
+
```
|
313
|
+
protected $redirectTo = '/home';
|
314
|
+
```
|
315
|
+
これを
|
316
|
+
```
|
317
|
+
protected $redirectTo = '/mypage/profile';
|
318
|
+
```
|
319
|
+
これに変えた。
|
320
|
+
|
321
|
+
②RegisterController.phpに
|
322
|
+
```
|
323
|
+
protected function redirectTo()
|
324
|
+
{
|
325
|
+
return route('mypage.prof');
|
326
|
+
}
|
327
|
+
```
|
328
|
+
上記のredirectToメソッドを作成
|
329
|
+
|
330
|
+
|
331
|
+
③ブラウザをChromeでやっていたので、safariに変えてみた
|
332
|
+
|
333
|
+
④vagrantとhomesteadでサーバーを立ててやっていたので、php artisan serveの方でやってみた
|
334
|
+
|
335
|
+
⑤php artisan キャッシュクリア系のコマンドでキャッシュクリアしてみた
|
336
|
+
|
337
|
+
上記のことを試しても挙動が変わりませんでした。自分で調べれる限りは試してみたのですがエラーも出ていないしさっぱり原因がわかりません。他に考えうる原因はあるのでしょうか?
|
1
訂正
title
CHANGED
File without changes
|
body
CHANGED
@@ -69,32 +69,77 @@
|
|
69
69
|
|
70
70
|
**RegisterController.php**
|
71
71
|
```
|
72
|
-
|
72
|
+
<?php
|
73
|
-
{
|
74
|
-
// Authentication Routes...
|
75
|
-
$this->get('login', 'Auth\LoginController@showLoginForm')->name('login');
|
76
|
-
$this->post('login', 'Auth\LoginController@login');
|
77
|
-
$this->get('logout', 'Auth\LoginController@showLogout')->name('logout');
|
78
|
-
$this->post('logout', 'Auth\LoginController@logout');
|
79
73
|
|
80
|
-
|
74
|
+
namespace App\Http\Controllers\Auth;
|
81
|
-
if ($options['register'] ?? true) {
|
82
|
-
$this->get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
|
83
|
-
$this->post('register', 'Auth\RegisterController@register');
|
84
|
-
}
|
85
|
-
$this->get('withdraw', 'Auth\RegisterController@showWithdraw')->name('withdraw');
|
86
75
|
|
76
|
+
use App\User;
|
77
|
+
use App\Http\Controllers\Controller;
|
78
|
+
use Illuminate\Support\Facades\Hash;
|
79
|
+
use Illuminate\Support\Facades\Validator;
|
80
|
+
use Illuminate\Foundation\Auth\RegistersUsers;
|
87
81
|
|
88
|
-
// Password Reset Routes...
|
89
|
-
|
82
|
+
class RegisterController extends Controller
|
83
|
+
{
|
84
|
+
/*
|
85
|
+
|--------------------------------------------------------------------------
|
90
|
-
|
86
|
+
| Register Controller
|
87
|
+
|--------------------------------------------------------------------------
|
91
|
-
|
88
|
+
|
|
89
|
+
| This controller handles the registration of new users as well as their
|
90
|
+
| validation and creation. By default this controller uses a trait to
|
91
|
+
| provide this functionality without requiring any additional code.
|
92
|
+
|
|
93
|
+
*/
|
92
94
|
|
95
|
+
use RegistersUsers;
|
96
|
+
|
97
|
+
/**
|
93
|
-
|
98
|
+
* Where to redirect users after registration.
|
99
|
+
*
|
100
|
+
* @var string
|
101
|
+
*/
|
94
|
-
|
102
|
+
protected $redirectTo = '/mypage/profile';
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Create a new controller instance.
|
106
|
+
*
|
107
|
+
* @return void
|
108
|
+
*/
|
109
|
+
public function __construct()
|
110
|
+
{
|
95
|
-
|
111
|
+
$this->middleware('guest');
|
96
|
-
}
|
97
112
|
}
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Get a validator for an incoming registration request.
|
116
|
+
*
|
117
|
+
* @param array $data
|
118
|
+
* @return \Illuminate\Contracts\Validation\Validator
|
119
|
+
*/
|
120
|
+
protected function validator(array $data)
|
121
|
+
{
|
122
|
+
return Validator::make($data, [
|
123
|
+
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
124
|
+
'password' => ['required', 'string', 'min:6',],
|
125
|
+
]);
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Create a new user instance after a valid registration.
|
130
|
+
*
|
131
|
+
* @param array $data
|
132
|
+
* @return \App\User
|
133
|
+
*/
|
134
|
+
protected function create(array $data)
|
135
|
+
{
|
136
|
+
return User::create([
|
137
|
+
'email' => $data['email'],
|
138
|
+
'password' => Hash::make($data['password']),
|
139
|
+
]);
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
98
143
|
```
|
99
144
|
|
100
145
|
**RegistersUsers.php**
|