前提・実現したいこと
Laravel6.0で旅行投稿サイトを制作しています。
今発生している問題は、login.blade.phpで「パスワードをお忘れの方」からパスワードリセットのためのemail.blade.phpに飛ばそうとしていますが、下記のエラーが発生しています。
ご教授いただけますと幸いです。
発生している問題・エラーメッセージ
The GET method is not supported for this route. Supported methods: POST
該当のソースコード
login.blade.php @extends('layouts.app') @section('content') <div class="text-center"> <h1 style="font-family:serif; text-align:center; margin-top:20px;">ログイン</h1> </div> <div class="row"> <div class="col-sm-6 offset-sm-3"> {!! Form::open(['route' => 'login.post']) !!} <div class="form-group"> {!! Form::label('email', 'Email') !!} {!! Form::email('email', old('email'), ['class' => 'form-control']) !!} </div> <div class="form-group"> {!! Form::label('password', 'Password') !!} {!! Form::password('password', ['class' => 'form-control']) !!} </div> {!! Form::submit('ログイン', ['class' => 'btn btn-primary btn-block']) !!} <div class="text"> <h6 style="font-family:serif; text-align:center; margin-top:20px;"><a href="/signup" class="btn btn-link">ユーザー登録がまだの方</a></h6> </div> <div class="text"> <h6 style="font-family:serif; text-align:center; margin-top:20px;"><a href="{{ route('password.email') }}" class="btn btn-link" >パスワードをお忘れの方</a></h6> </div> {!! Form::close() !!} </div> </div> @endsection
<?php /* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | contains the "web" middleware group. Now create something great! | */ Route::get('/' , 'ContentController@index')->name('index'); Auth::routes(['verify' => true]); Route::get('signup', 'Auth\RegisterController@showRegistrationForm')->name('signup.get'); Route::post('signup', 'Auth\RegisterController@register')->name('signup.post'); Route::get('login' , 'Auth\LoginController@showLoginForm')->name('login'); Route::post('login' , 'Auth\LoginController@login')->name('login.post'); Route::get('logout' , 'Auth\LoginController@logout')->name('logout.get'); Route::get('search' , 'SearchController@index')->name('search'); Route::get('/contact' , 'ContactController@index')->name('contact.index'); Route::post('/contact/confirm' , 'ContactController@confirm')->name('contact.confirm'); Route::match(['get', 'post'], '/contact/send' ,'ContactController@send')->name('contact.send'); Route::post('password/email' , 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email'); Route::post('password/confirm' , 'Auth\ConfirmPasswordController@showConfirmForm')->name('password.confirm'); Route::get('password/reset/{token}' , 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.update'); Route::post('password/reset', 'Auth\ResetPasswordController@reset'); Route::group(['middleware' => ['auth']], function(){ Route::resource('/content' , 'ContentController' , ['except'=>['index']]); Route::resource('users', 'UsersController', ['only' => ['index' , 'show' ]]); });
email.blade.php @extends('layouts.app') @section('content') <div class="container"> <div class="row justify-content-center"> <div class="col-md-8"> <div class="card"> <div class="card-header">{{ __('Reset Password') }}</div> <div class="card-body"> @if (session('status')) <div class="alert alert-success" role="alert"> {{ session('status') }} </div> @endif <form method="POST" action="{{ route('password.email') }}"> @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 mb-0"> <div class="col-md-6 offset-md-4"> <button type="submit" class="btn btn-primary"> {{ __('Send Password Reset Link') }} </button> </div> </div> </form> </div> </div> </div> </div> </div> @endsection
試したこと
・ @csrf追加
・Route::match([get,post]~の実装
補足情報(FW/ツールのバージョンなど)
Laravel6.0
回答2件
あなたの回答
tips
プレビュー