Question: Hi guys new to laravel here. I am trying to edit my post and when i try to access the `edit` function in my controller i get this `error Property [id] does not exist on this collection instance.`

> 
> This is My route code 
> 
> 
> 

```
Route::resource('/article','PostController'); 

```

> 
> This is my Controller 
> 
> 
> 

```
public function edit(Post $post)
{

    $post = Post::all();
    return view('article.edit',compact('post'));

}

```

> 
> This is my View code 
> 
> 
> 

```
<a href="{{route('article.edit', $post->id)}}" class="btn btn-info btn-sm btn-bordred wave-light"> 
<i class="fas fa-edit"></i></a>

```

> 
> And solution ? Thanks in advance
> 
> 
>

Answer: 
When you use "all", you will get all data from post table. In edit function you get $id as a parameter.

```
public function edit($id)
{

    $post = Post::find($id);
    return view('article.edit',compact('post'));

}

```
`Post::all()` return a Collection (multiple Models)

You need to pass the id in the `edit($id) function` and then you can `find($id)`

```
 public function edit($id){
      $post = Post::find($id);
      return view('article.edit')->with('post', $post);
 }

```