title: ErrorException Trying to get property of non-object I'm just trying to get to my edit page this error wont let me
body: <p>on my home.blade.php view</p>
  
  <pre><code>&lt;a href="{{ route('posts.edit') }}" class="btn btn-info"&gt;&amp;nbsp;&amp;nbsp;Edit&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/a&gt;
  </code></pre>
  
  <p>i just want to view the edit page when i click this link but an ErrorException occur what could be wrong?</p>
  
  <p>this is my PostController</p>
  
  <pre><code>public function edit($id)
      {
          //
          $post = Post::find($id);
          return view('posts.edit')-&gt;withPost($post);
      }
  </code></pre>
  
  <p>heres my web.php where all my route is </p>
  
  <pre><code>Route::get('posts/home', function () {
      return view('posts/home');
  });
  
  Route::get('about', function () {
      return view('about');
  });
  
  Route::get('contact', function () {
      return view('contact');
  });
  
  Route::get('posts', function () {
      return view('posts/index');
  });
  
  Route::get('login', function () {
      return view('login');
  });
  
  Route::resource('posts', 'PostController');
  //Route::post('posts', 'PostController@store');
  Route::post('posts', 'PostController@store')-&gt;name('insert');
  Route::post('posts', 'PostController@update')-&gt;name('update');
  Route::get('posts/create', 'PostController@create');
  </code></pre>