mardi 31 décembre 2019

Is there a solution for Missing required parameters for [Route:....?

I have searched everywhere and no one has provided a proper solution or it is left unanswered. Could someone please help me with this error? I have been struggling for days now. enter image description here

Missing required parameters for [Route: helper.update] [URI: helper/{id}]. (View: D:\Training\LaravelProjects\helps\resources\views\helper\edit.blade.php)

I have followed the documentation and still i can't figure out what is wrong. This is my code.

Web.php

Route::group(['prefix' => 'helper'], function (){
 Route::get('/create', [
    'uses' => 'HelperController@create',
    'as' => 'helper.create'
 ]);

 Route::get('/{id}/edit', [
    'uses' => 'HelperController@edit',
    'as' => 'helper.edit'
 ]);

 Route::get('/{id}', [
    'uses' => 'HelperController@show',
    'as' => 'helper.show'
 ]);

 Route::post('/', [
    'uses' => 'HelperController@store',
    'as' => 'helper.store'
 ]);

 Route::put('/{id}', [
    'uses' => 'HelperController@update',
    'as' => 'helper.update'
 ]);

 Route::delete('/{id}', [
    'uses' => 'HelperController@destroy',
    'as' => 'helper.destroy'
 ]);
});

HelperController.php

public function edit($id)
{
    $helper = Helper::find($id);
    return view('helper.edit', compact('helper'));
}

index.blade.php

<tbody>
                @foreach($helpers as $helper)
                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>
                        <a href="" class="edit">
                            <i class="fas fa-pencil-alt" title="Edit" style="font-size: 16px"></i>
                        </a>
                        <a href="#deleteEmployeeModal" class="delete" data-toggle="modal" data-widget="">
                            <i class="fas fa-trash" title="Delete" style="font-size: 16px"></i>
                        </a>
                    </td>
                </tr>
                @endforeach

All I want is to open the edit.blade.php file once I click edit link. The delete part is incomplete and please ignore that. Also, the id is being passed as a parameter but stil says it's missing. Check this image enter image description here



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire