Missing required parameters for [Route: projects.edit] [URI: projects/{project}/edit] Laravel 6.3

我只是一个虾纸丫 提交于 2020-05-17 05:49:06

问题


This error has blocked me way forward. Does anyone have a solution to the Missing required parameters error? I have a very simple CRUD setup which throws this error in the Controller 'edit' method. This happens when the request is forwarded to the edit view.

Error:

```Facade\Ignition\Exceptions\ViewException
Missing required parameters for [Route: projects.edit] [URI: 
projects/{project}/edit]. (View: 
T:\estie\resources\views\frontend\layouts\homeapp.blade.php)```

Route definition is:

```Route::resource('projects','ProjectsController');```

Controller Edit method:

```public function edit(Project $project)
    {
        return view('projects.edit')  ->with('project',$project);    
    }```

This is part of my index.blade.php which extends homeapp.blade.php:

<td align="center">
       <a href="{{ route('projects.edit', ['project' => $project]) }}">EDIT</a>
</td>

Appreciate any help, please.


回答1:


This error is thrown when you try to get the URL of a route using the route function without providing a required parameter.

Look for the route('projects.edit') call in your homeapp.blade.php and add the project as a parameter: route('projects.edit', ['project' => $project])



来源:https://stackoverflow.com/questions/61028370/missing-required-parameters-for-route-projects-edit-uri-projects-project

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!