MethodNotAllowedHttpException No message

Published 5 months ago by Geoff_256

I think I'm having issues with my routes here is my route

Route::post('/auditor/update', array( "as" => "auditor.update", "uses" => "[email protected]")); Route::get('/auditor/{id}/show', array( "as" => "", "uses" => "[email protected]" )); Route::get('/auditor/{id}/edit', array( "as" => "auditor.edit", "uses" => "[email protected]" ));


public function update(Request $request, $id) { request()->validate([ 'name' => 'required', 'phone_number' => 'required', ]); Auditor::find($id)->update($request->all()); return redirect()->route('auditor.index') ->with('success','Auditor updated successfully'); } Blade

{!! Form::model($auditor, ['method'=>'PATCH', 'route' => ['auditor.update', $auditor->id]]) !!}
  <div class="row">
      <div class="form-group col-md-1"><strong>Name </strong></div>
      <div class="col-md-2"> {!! Form::text('name', null, array('class' => 'form-control')); !!} </div>
  <div class="row">
      <div class="form-group col-md-1"><strong>Phone Contact </strong></div>
      <div class="col-md-2"> {!! Form::text('phone_number', null, array('class' => 'form-control')); !!} </div>

  <div class="row text-center">
      <div class="form-group col-md-1"><strong>Designation </strong></div>
      <div class="col-md-2"> {!! Form::text('designation', null, array('class' => 'form-control')); !!} </div>
  <div class="row">
      <div class="form-group col-md-1"><strong>Organization </strong></div>
      <div class="col-md-2"> {!! Form::text('organization', null, array('class' => 'form-control')); !!} </div>

   <div class="row">
      <div class="form-group col-md-1"><strong>Email </strong></div>
      <div class="col-md-2"> {!! Form::email('email', null, array('class' => 'form-control')); !!} </div>

    <div class="col-xs-12 col-sm-12 col-md-12 text-center">

            <button type="submit" class="btn btn-primary">Submit</button>

{!! Form::close() !!}

Have lost enough hair on this .....I kindly seek your help

5 months ago (143,050 XP)

@Geoff_256 try

{!! Form::model($auditor, ['method'=>'POST', 'route' => ['auditor.update', $auditor->id]]) !!}

@Dry7 same error

5 months ago (878,685 XP)

Your method is PATCH but you don't have a PATCH route?

You are trying to send auditor->id through with the form, but you don't accept the ID in the route

Route::post('/auditor/update', array( "as" => "auditor.update", "uses" => "[email protected]")); 


Route::patch('/auditor/{id}', array( "as" => "auditor.update", "uses" => "[email protected]")); 

Please sign in or create an account to participate in this conversation.