Совершенно новый для Laravel, после учебника для многопользовательской аутентификации.(https://www.youtube.com/watch?v=55YoSeS6egs)
Все прошло довольно гладко, но по какой-то причине мой админ (restaurantuser) не входит в систему. Он буквально просто обновляет страницу без ошибок. Я сравнил репозитории и не могунайти любые ошибки.
Я думаю, что это ошибка кодирования несовпадения версий. Я предоставлю весь соответствующий код, и, надеюсь, кто-то может помочь мне.
форма логин html
<div class="card-body">
<form method="POST" action="{{ route('restaurantuser.login.submit') }}">
@csrf
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<div class="col-md-6 offset-md-4">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}>
<label class="form-check-label" for="remember">
{{ __('Remember Me') }}
</label>
</div>
</div>
</div>
<div class="form-group row mb-0">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Login') }}
</button>
@if (Route::has('password.request'))
<a class="btn btn-link" href="{{ route('password.request') }}">
{{ __('Forgot Your Password?') }}
</a>
@endif
</div>
</div>
</form>
web
Route::prefix('restaurantuser')->group(function() {
Route::get('/login', 'Auth\RestaurantUserLoginController@showLoginForm')->name('restaurantuser.login');
Route::post('/login', 'Auth\RestaurantUserLoginController@login')->name('restaurantuser.login.submit');
Route::get('/', 'RestaurantUserController@index')->name('restaurantuser.dashboard');
Route::get('/logout', 'Auth\RestaurantUserLoginController@logout')->name('restaurantuser.logout');
});
пользователь ресторана входит в систему контроллера
public function login(Request $request) {
// Validate the form data
$this->validate($request, [
'email' => 'required|email',
'password' => 'required|min:6'
]);
// Attempt to log the user in
if (Auth::guard('restaurantuser')->attempt(['email' => $request->email, 'password' => $request->password], $request->remember)) {
// if successful, then redirect to their intended location
return redirect()->intended(route('restaurantuser.dashboard'));
}
// if unsuccessful, then redirect back to the login with the form data
return redirect()->back()->withInput($request->only('email', 'remember'));
}
dd по запросу:
Request {#43 ▼
#json: null
#convertedFiles: null
#userResolver: Closure($guard = null) {#183 ▶}
#routeResolver: Closure() {#185 ▶}
+attributes: ParameterBag {#45 ▶}
+request: ParameterBag {#44 ▶}
+query: ParameterBag {#51 ▶}
+server: ServerBag {#47 ▶}
+files: FileBag {#48 ▶}
+cookies: ParameterBag {#46 ▶}
+headers: HeaderBag {#49 ▶}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/restaurantuser/login"
#requestUri: "/assignment2/public/restaurantuser/login"
#baseUrl: "/assignment2/public"
#basePath: null
#method: "POST"
#format: null
#session: Store {#220 ▶}
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: "/assignment2/public"
format: "html"
если требуется какой-либо еще код, дайте мне знать иЯ немедленно обновлю его. Это для школьного проекта, поэтому любая помощь будет принята с благодарностью.