お疲れ様です。表題の通りですが上手くいきません。
basic1.blade.php
php
1@extends('layouts.layout') 2 3@section('title', 'basic1') 4 5@section('content') 6<form action="/basic1" method="post"> 7 8 {{ csrf_field() }} 9 10 <div class="form-group my-5"> 11 <label for="formGroupExampleInput" class="font-weight-bold">名前</label> 12 <input type="text" name="name" value="{{ old('name') }}" class="form-control" id="formGroupExampleInput" 13 placeholder="名前をスペースなしで入力してください" maxlength="64"> 14 @if ($errors->has('name')) 15 <span class="errormsg">{{ $errors->first('name') }}</span> 16 @endif 17 </div> 18 19 <div class="form-group mb-5"> 20 <label for="formGroupExampleInput" class="font-weight-bold">ナマエ</label> 21 <input type="text" name="kana" value="{{ old('kana') }}" class="form-control" id="formGroupExampleInput" 22 placeholder="ナマエをスペースなしで入力してください" maxlength="64"> 23 @if ($errors->has('kana')) 24 <span class="errormsg">{{ $errors->first('kana') }}</span> 25 @endif 26 </div> 27 28 <p class="font-weight-bold h6">性別</p> 29 <div class="custom-control custom-radio custom-control-inline mb-5"> 30 <input type="radio" id="customRadioInline1" name="customRadioInline1" class="custom-control-input"> 31 <label class="custom-control-label font-weight-bold" for="customRadioInline1">男性</label> 32 </div> 33 <div class="custom-control custom-radio custom-control-inline"> 34 <input type="radio" id="customRadioInline2" name="customRadioInline1" class="custom-control-input"> 35 <label class="custom-control-label font-weight-bold" for="customRadioInline2">女性</label> 36 </div> 37 38 <div class="form-group mb-5"> 39 <label for="formGroupExampleInput" class="font-weight-bold">電話番号</label> 40 <input type="tel" name="tel" class="form-control" value="{{ old('tel') }}" id="formGroupExampleInput" 41 placeholder="電話番号をハイフンなしで入力してください"> 42 @if ($errors->has('tel')) 43 <span class="errormsg">{{ $errors->first('tel') }}</span> 44 @endif 45 </div> 46 47 <div class="form-group mb-5"> 48 <label for="formGroupExampleInput" class="font-weight-bold">メールアドレス(任意)</label> 49 <input type="text" name="email" value="{{ old('email') }}" class="form-control" id="formGroupExampleInput" 50 placeholder="メールアドレスを入力してください"> 51 @if ($errors->has('email')) 52 <span class="errormsg">{{ $errors->first('email') }}</span> 53 @endif 54 </div> 55 56 <div class="form-group mb-5"> 57 <label for="formGroupExampleInput" class="font-weight-bold">ログインID</label> 58 <input type="text" name="id" value="{{ old('id') }}" class="form-control" id="formGroupExampleInput" 59 placeholder="ログインIDは英数字を含んだ16文字以下で入力してください" maxlength="16"> 60 @if ($errors->has('id')) 61 <span class="errormsg">{{ $errors->first('id') }}</span> 62 @endif 63 </div> 64 65 <div class="form-group mb-5"> 66 <label for="formGroupExampleInput" class="font-weight-bold">パスワード</label> 67 <input type="text" name="pass" class="form-control" id="formGroupExampleInput" 68 placeholder="パスワードは英数字を含んだ16文字以下で入力してください" maxlength="16"> 69 @if ($errors->has('pass')) 70 <span class="errormsg">{{ $errors->first('pass') }}</span> 71 @endif 72 </div> 73 74 <button type="submit" class="btn btn-primary mb-5">Next</button> 75 76</form> 77@endsection 78
コントローラー
php
1<?php 2 3namespace App\Http\Controllers; 4 5use Illuminate\Http\Request; 6use App\Http\Requests\BasicRequest; 7use App\Http\Models\RegisterDao; 8 9class BasicController extends Controller 10{ 11 public function index() 12 { 13 // $registerdao = new RegisterDao(); 14 // dd($registerdao->getUser()->toArray()); 15 return view('register.basic1'); 16 } 17 18 public function index2() 19 { 20 return view('register.basic2'); 21 } 22 23 public function check(BasicRequest $request) 24 { 25 if (!isset($request->email)) { 26 $this->validate($request, [ 27 'email' => 'email', 28 ]); 29 } 30 return view('register.basic2'); 31 } 32}
ルート
php
1<?php 2 3/* 4|-------------------------------------------------------------------------- 5| Web Routes 6|-------------------------------------------------------------------------- 7| 8| Here is where you can register web routes for your application. These 9| routes are loaded by the RouteServiceProvider within a group which 10| contains the "web" middleware group. Now create something great! 11| 12*/ 13 14 15Route::get('/', 'BasicController@index'); 16Route::get('/basic2', 'BasicController@index2'); 17Route::post('/basic1', 'BasicController@check');
\basic1で送信すると、checkに入ってきて処理をするはずですが、この中に飛んできていません。どこに原因があると考えられますか。
バリデーションのチェックは自作のクラスを使用しています。
回答1件
あなたの回答
tips
プレビュー