laravelの学習を進めていたのですが、エラーが発生してしまい解決できない為、ご質問させて貰いました。
下記は、ビュー部分のindex.blade.phpです
php
1@extends('layouts.helloapp') 2@section('title','Index') 3@section('menubar') 4 @parent 5 インデックスページ 6@endsection 7@section('content') 8 <p>{{$msg}}</p> 9 <table> 10 <form action="./hello" method="post"> 11 {{ csrf_field() }} 12 <tr> 13 <th>name: </th> 14 <td><input type="text" name="name"></td> 15 </tr> 16 <tr> 17 <th>mail:</th> 18 <td><input type="text" name="mail"></td> 19 </tr> 20 <tr> 21 <th>age:</th> 22 <td><input type="text" name="age"></td> 23 </tr> 24 <tr> 25 <th></th> 26 <td><input type="submit" value="send"></td> 27 </tr> 28 </form> 29 </table> 30 31@endsection 32 33@section('footer') 34copyright 2017 tuyano. 35@endsection
下記は、コントローラーの「HelloController.php」です
php
1<?php 2 3namespace App\Http\Controllers; 4 5use Illuminate\Http\Request; 6use Illuminate\Http\Response; 7 8class HelloController extends Controller{ 9 10 public function index(Request $request) 11 { 12 13 return view('hello.index',['msg'=> 'フォームを入力:']); 14 } 15 16 public function post(Request $request) 17 { 18 $validate_rule = [ 19 'name' => 'required', 20 'mail' => 'email', 21 'age' => 'numeric|between:0,150', 22 ]; 23 24 $this->validate($request,$validate_rule); 25 26 return view('hello.index',['msg'=>'正しく入力されました!']); 27 28 } 29 30 31}
下記は、ルート情報を記載した「web.php」です
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 15// Route::post('hello','HelloContoroller@post'); 16 17use App\Http\Middleware\HelloMiddleware; 18 19Route::get('hello','HelloController@index'); 20Route::post('hello','HelloController@post'); 21 22// Route::get('hello/other','HelloController@other'); 23
エラーの内容は、下記の通りです。
エラーの内容で検索したのですが、解決できなかった為、どなたか解決法をご存じでしたら教えて下さい。
よろしくお願いします。


回答1件
あなたの回答
tips
プレビュー