Question: So I have a little project, in it, there's the possibility to upload banners images to be shown on the main page. All the stuff related to the DB are already created and the option to create a banner is working, it creates the banner and then stores the image on the DB for use later. Now I'm trying to work on an edit function so I can change the description under the bannners. I have an Edit route in my controller which returns a view where I edit said banner then it calls the update function on the controller. But no matter what I put here, I'm always getting the Missing Required Parameters error once I try to Save the edit and open my controller through the Update function. Here's the code as it is now:

The route definition:

```
Route::resource('banner', 'BannerController');

```

The edit function on my controller:

```
    public function edit($id)
{

    return view('admin/edit-banners',['id'=>$id]);
}

```

The update function has not been implemented because I always start with a dd() function to check if everything is working fine:

```
    public function update(Request $request, $id)
{
    dd($request);
}

```

And here's the form line in my edit view that is trying to call the update route:

```
<form class="card-box" action="{{ route('banner.update',[$banner]) }}">

```

I also added this at the beginning of the view to store the data from the DB into a variable:

```
@php
    use\App\Banner;
    $banner = Banner::where('id','=',$id)->get();
@endphp

```

The $banner variable contains all the information on the banner being edited, and I can get the new description at the controller with the $request variable, so I honestly don't know what should I put here as parameters, any ideas?

Answer: 
The `$banner` variable is not a Model instance, it is a Collection.

Adjust your controller to pass this to the view instead of dong the query in the view:

```
public function edit($id)
{
    $banner = Banner::findOrFail($id);

    return view('admin.edit-banners', ['banner' => $banner]);
}

```

You could also use Route Model Binding here instead of doing the query yourself.

Remove that `@php` block from your view.

The form should be adjusted to use method `POST` and spoof the method `PUT` or `PATCH` (as the update route is a `PUT` or `PATCH` route) and you should adjust the call to `route`:

```
<form class="card-box" action="{{ route('banner.update', ['banner' => $banner]) }}" method="POST">
    @method('PUT')

```
If you include `$id` in your function declaration then when you call the `route` helper it expects you to give it an `id` parameter. Try with

```
<form class="card-box" action="{{ route('banner.update',['id' => $id]) }}">

```

You should be able to retrieve the form data just fine form the `$request` variable. More info [here](https://laravel.com/docs/8.x/routing#named-routes).