質問編集履歴
1
LoginControllerのコードを追加しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -51,4 +51,84 @@
|
|
51
51
|
|
52
52
|
```
|
53
53
|
|
54
|
+
LoginControllerのコードは以下になります
|
55
|
+
|
56
|
+
```PHP
|
57
|
+
<?php
|
58
|
+
|
59
|
+
namespace App\Http\Controllers\Auth;
|
60
|
+
|
61
|
+
use App\Http\Controllers\Controller;
|
62
|
+
use App\Providers\RouteServiceProvider;
|
63
|
+
use Illuminate\Http\Request;
|
64
|
+
use Illuminate\Support\Facades\Auth;
|
65
|
+
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
66
|
+
|
67
|
+
class LoginController extends Controller
|
68
|
+
{
|
69
|
+
/*
|
70
|
+
|--------------------------------------------------------------------------
|
71
|
+
| Login Controller
|
72
|
+
|--------------------------------------------------------------------------
|
73
|
+
|
|
74
|
+
| This controller handles authenticating users for the application and
|
75
|
+
| redirecting them to your home screen. The controller uses a trait
|
76
|
+
| to conveniently provide its functionality to your applications.
|
77
|
+
|
|
78
|
+
*/
|
79
|
+
|
80
|
+
use AuthenticatesUsers;
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Where to redirect users after login.
|
84
|
+
*
|
85
|
+
* @var string
|
86
|
+
*/
|
87
|
+
protected $redirectTo = RouteServiceProvider::HOME;
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Create a new controller instance.
|
91
|
+
*
|
92
|
+
* @return void
|
93
|
+
*/
|
94
|
+
public function __construct()
|
95
|
+
{
|
96
|
+
$this->middleware('guest')->except('logout');
|
97
|
+
$this->middleware('guest:admin')->except('logout');
|
98
|
+
}
|
99
|
+
|
100
|
+
/**
|
101
|
+
* 管理者ログイン用
|
102
|
+
*/
|
103
|
+
public function showAdminLoginForm(){
|
104
|
+
return view('auth.login',['authgroup' => 'admin']);
|
105
|
+
}
|
106
|
+
|
107
|
+
public function adminLogin(Request $request){
|
108
|
+
$this->validate($request, [
|
109
|
+
'email' => 'required|email',
|
110
|
+
'password' => 'required|min:8'
|
111
|
+
]);
|
112
|
+
|
113
|
+
if(method_exists($this, 'hasTooManyLoginAttempts') &&
|
114
|
+
$this->hasTooManyLoginAttempts($request)){
|
115
|
+
$this->fireLockoutEvent($request);
|
116
|
+
|
117
|
+
return $this->sendLockoutResponse($request);
|
118
|
+
}
|
119
|
+
|
120
|
+
if(Auth::guard('admin')->attempt(['email' => $request->email,'password' => $request->password],$request->get('remember'))){
|
121
|
+
return redirect()->intended('/admin');
|
122
|
+
}
|
123
|
+
|
124
|
+
|
125
|
+
$this->incrementLoginAttempt($request);
|
126
|
+
|
127
|
+
return back()->withInput($request->only('email','remember'));
|
128
|
+
}
|
129
|
+
|
130
|
+
}
|
131
|
+
|
132
|
+
```
|
133
|
+
|
54
134
|
他に確認する箇所はどこでしょうか?
|