0
votes

I encountered an issue with the route as follows.

Route [forgotpassword/reset] not defined.

Login forgotpassword url

<div class="forgot-password"><a href="{{ url('/forgotpassword/reset') }}" class="small">Forgot password?</a></div>

Route code

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');
});

ForgotPasswordController Code

<?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');
}

}

I overwrite function ShowLink to return view into my forgotPassword blade.

and here's my forgotPassword 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

Any help in this regard will be appreciated

1
Can you provide artisan route:list output? - Anton
@Anton | POST | forgotpassword/email | | App\Http\Controllers\Auth\ForgotPasswordController@sendResetLinkEmail | web,guest | | | GET|HEAD | forgotpassword/reset | | App\Http\Controllers\Auth\ForgotPasswordController@showLinkRequestForm | web,guest - Andrew Vanusi

1 Answers

2
votes

Change your route to named route like:

Route::get('/forgotpassword/reset', [ 'as' => 'forgotpassword/reset', 'uses' => 'ForgotPasswordController@showLinkRequestForm']);

And as of your view file I found this:

{!! Form::open(['method' => 'forgotpassword','route' =>  ['forgotpassword/reset']]) !!}

Use 'method' => 'get'