路线未定义。 Laravel 5.3
Route not defined. Laravel 5.3
我遇到了如下路线问题。
Route [forgotpassword/reset] not defined.
登录忘记密码url
<div class="forgot-password"><a href="{{ url('/forgotpassword/reset') }}" class="small">Forgot password?</a></div>
航线代码
Route::group(['namespace' => 'Auth'], function() {
Route::get('/forgotpassword/reset', 'ForgotPasswordController@showLinkRequestForm');
Route::post('/forgotpassword/email', 'ForgotPasswordController@sendResetLinkEmail');
Route::get('/password/reset/{token}', 'ResetPasswordController@showResetForm');
Route::post('/password/reset', 'ResetPasswordController@reset');
});
忘记密码控制器代码
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Base\BaseController;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends BaseController
{
use SendsPasswordResetEmails;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
public function showLinkRequestForm()
{
return view('password.forgotpassword');
}
}
我将函数 ShowLink 覆盖到 return 查看我忘记的密码 blade。
这是我的忘记密码blade
@extends('layout.master')
@section('content')
<div id="content" class="content">
@include('partials.breadcrumbs')
<h1 class="page-header">Change <small>password</small></h1>
@include('partials.message')
<div class="row">
<div class="col-md-12">
<div class="panel panel-inverse" data-sortable-id="ui-general-1">
<div class="panel-heading">
<h2 class="panel-title">Change Password</h2>
</div>
<div class="panel-body">
{!! Form::open(['method' => 'forgotpassword','route' => ['forgotpassword/reset']]) !!}
<div class="forgot-password-form">
@if (Session::has('message'))
<div class="col-sm-12">
<div class="alert alert-success">
{{ Session::get('message') }}
</div>
</div>
@endif
{!! csrf_field() !!}
<div class="row ct-no-margin">
<div class="col-sm-4 col-xs-12">
<div class="form-group">
<div class="{{ $errors->has('email') ? ' has-error' : '' }}">
<div class="row ct-no-margin">
<div class="col-sm-12 ct-no-padding">
<label for="">Email address</label>
</div>
<div class="col-sm-12 ct-no-padding">
<input type="email" name="email" class="form-control" required/>
</div>
@if ($errors->has('email'))
<span class="help-block error-email">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn fp-submit-btn">Submit</button>
<a href="/admin/login" class="fp-cancel-btn">Cancel</a>
</div>
</div>
</div>
</form>
</div>
</div>
</section>
</div>
@endsection
在这方面的任何帮助将不胜感激
将您的路线更改为命名路线,例如:
Route::get('/forgotpassword/reset', [ 'as' => 'forgotpassword/reset', 'uses' => 'ForgotPasswordController@showLinkRequestForm']);
根据你的视图文件,我发现了这个:
{!! Form::open(['method' => 'forgotpassword','route' => ['forgotpassword/reset']]) !!}
使用'method' => 'get'
我遇到了如下路线问题。
Route [forgotpassword/reset] not defined.
登录忘记密码url
<div class="forgot-password"><a href="{{ url('/forgotpassword/reset') }}" class="small">Forgot password?</a></div>
航线代码
Route::group(['namespace' => 'Auth'], function() {
Route::get('/forgotpassword/reset', 'ForgotPasswordController@showLinkRequestForm');
Route::post('/forgotpassword/email', 'ForgotPasswordController@sendResetLinkEmail');
Route::get('/password/reset/{token}', 'ResetPasswordController@showResetForm');
Route::post('/password/reset', 'ResetPasswordController@reset');
});
忘记密码控制器代码
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Base\BaseController;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends BaseController
{
use SendsPasswordResetEmails;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
public function showLinkRequestForm()
{
return view('password.forgotpassword');
}
}
我将函数 ShowLink 覆盖到 return 查看我忘记的密码 blade。
这是我的忘记密码blade
@extends('layout.master')
@section('content')
<div id="content" class="content">
@include('partials.breadcrumbs')
<h1 class="page-header">Change <small>password</small></h1>
@include('partials.message')
<div class="row">
<div class="col-md-12">
<div class="panel panel-inverse" data-sortable-id="ui-general-1">
<div class="panel-heading">
<h2 class="panel-title">Change Password</h2>
</div>
<div class="panel-body">
{!! Form::open(['method' => 'forgotpassword','route' => ['forgotpassword/reset']]) !!}
<div class="forgot-password-form">
@if (Session::has('message'))
<div class="col-sm-12">
<div class="alert alert-success">
{{ Session::get('message') }}
</div>
</div>
@endif
{!! csrf_field() !!}
<div class="row ct-no-margin">
<div class="col-sm-4 col-xs-12">
<div class="form-group">
<div class="{{ $errors->has('email') ? ' has-error' : '' }}">
<div class="row ct-no-margin">
<div class="col-sm-12 ct-no-padding">
<label for="">Email address</label>
</div>
<div class="col-sm-12 ct-no-padding">
<input type="email" name="email" class="form-control" required/>
</div>
@if ($errors->has('email'))
<span class="help-block error-email">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn fp-submit-btn">Submit</button>
<a href="/admin/login" class="fp-cancel-btn">Cancel</a>
</div>
</div>
</div>
</form>
</div>
</div>
</section>
</div>
@endsection
在这方面的任何帮助将不胜感激
将您的路线更改为命名路线,例如:
Route::get('/forgotpassword/reset', [ 'as' => 'forgotpassword/reset', 'uses' => 'ForgotPasswordController@showLinkRequestForm']);
根据你的视图文件,我发现了这个:
{!! Form::open(['method' => 'forgotpassword','route' => ['forgotpassword/reset']]) !!}
使用'method' => 'get'