前提・実現したいこと
ログイン画面から登録画面に遷移させたい。
発生している問題・エラーメッセージ
Route [showregisterform] not defined. (View: C:\Users\jjyoj\jojo\resources\views\login.blade.php)
該当のソースコード
web.php
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>login</title>Route::get('login', 'Auth\LoginController@showLoginForm')->name('showLoginForm'); Route::post('login', 'Auth\LoginController@login')->name('login'); Route::get('register', 'Auth\RegisterController@showRegisterForm')->name('showregisterform'); Route::post('register', 'Auth\RegisterController@register')->name('register'); ```login.blade.php
</head> <body> <!-- header --> <header id="header"> <div class="container d-flex"> <div class="bland-logo mr-auto"> <img src="{{ asset('images/logo.png') }}" alt="" id="logo"> </div><!-- css --> <link href="{{ asset('/css/login.css') }}" rel="stylesheet"> <!-- bootstrap --> <link href="{{ asset('/css/app.css') }}" rel="stylesheet"> <!-- javascript --> <script src="{{ asset('/js/app.js')}}"></script>
</header> <!-- main page --> <div class="container"> <div class="card mx-auto"> <div class="card-body"> <h4 class="card-title">ログイン</h4> <hr class="title_line"> <form action="{{ route('login') }}" method="POST"> @csrf <div class="form-group input-group"> <input type="email" class="form-control" placeholder="メールアドレス" name="email"> <div class="input-group-prepend"> <span class="input-group-text"><i class="fas fa-envelope"></i></span> </div> </div> <div class="form-group input-group"> <input type="password" class="form-control" placeholder="パスワード" name="password"> <div class="input-group-prepend"> <span style="cursor: pointer;" class="input-group-text"><i class="far fa-eye-slash" aria-hidden="true"></i></span> </div> </div> <div class="form-group form-check"> <input type="checkbox" class="form-check-input" id="rememberCheck" value="remember-me"> <div class="input-group-addon"> </div> <label class="form-check-label" for="rememberCheck">ログイン状態を保つ</label> </div> <input type="submit" id="login" value="ログイン"> </form> <div class="text-center mt-5"> <a href="{{ route('password.request') }}" id="forget_pass">パスワードを忘れた場合はこちら</a> <hr> <a href="{{ route('showregisterform') }}" id="create_ac">今すぐアカウントを作成</a> </div> </div> </div> </div> <!-- footer --> <footer id="footer" class="clearfix fixed-bottom"> <div class="inner"> <div class="under_menu"> <ul class="align-self-center"> <li style="padding: 0;"></li> <li> <a href="">利用規約とプライバシー</a> </li> <li> <a href="">お問合せ</a> </li> </ul> </div> </div> </footer> </body> </html><!-- hamburger menu --> <div id="hamburger_menu"> <input type="checkbox" id="check"> <span class="span1 hum"></span> <span class="span2 hum"></span> <span class="span3 hum"></span> <label for="check" id="nav-close">MENU</label> <ul id="menu_list"> <li class="menu">メニュー1</li> <li class="menu">メニュー2</li> <li class="menu">メニュー3</li> <li class="menu">メニュー4</li> <li class="menu">メニュー5</li> </ul> </div> </div>
registercontroller
1```ここに言語を入力 2<?php 3 4namespace App\Http\Controllers\Auth; 5 6use App\Http\Controllers\Controller; 7use App\Member; 8use Illuminate\Foundation\Auth\RegistersUsers; 9use Illuminate\Support\Facades\Hash; 10use Illuminate\Support\Facades\Validator; 11 12class RegisterController extends Controller 13{ 14 /* 15 |-------------------------------------------------------------------------- 16 | Register Controller 17 |-------------------------------------------------------------------------- 18 | 19 | This controller handles the registration of new users as well as their 20 | validation and creation. By default this controller uses a trait to 21 | provide this functionality without requiring any additional code. 22 | 23 */ 24 25 use RegistersUsers; 26 27 /** 28 * Where to redirect users after registration. 29 * 30 * @var string 31 */ 32 protected $redirectTo = '/login'; 33 34 /** 35 * Create a new controller instance. 36 * 37 * @return void 38 */ 39 public function __construct() 40 { 41 $this->middleware('guest'); 42 } 43 44 /** 45 * Get a validator for an incoming registration request. 46 * 47 * @param array $data 48 * @return \Illuminate\Contracts\Validation\Validator 49 */ 50 51 public function showRegisterForm() 52 { 53 return view('register'); 54 } 55 56 protected function validator(array $data) 57 { 58 return Validator::make($data, [ 59 'name' => ['required', 'string', 'max:255'], 60 'email' => ['required', 'string', 'email', 'max:255', 'unique:members'], 61 'password' => ['required', 'string', 'min:8', 'confirmed'], 62 ]); 63 } 64 65 /** 66 * Create a new user instance after a valid registration. 67 * 68 * @param array $data 69 * @return \App\User 70 */ 71 protected function create(array $data) 72 { 73 return Member::create([ 74 'name' => $data['name'], 75 'email' => $data['email'], 76 'password' => Hash::make($data['password']), 77 ]); 78 } 79} 80
試したこと
ルート名を変えたがエラーの「」内が変わるだけだった。
補足情報(FW/ツールのバージョンなど)
ローカル環境開発
herfで直接urlを指定するのは今回できない
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/01/11 04:05
2021/01/11 04:27
2021/01/11 05:41
2021/01/11 05:48