laravel: Call to a member function delete() on null
<p>I got this error when I tried to add a feature of delete, to the posts just by clicking on the delete button.
Where am I doing wrong?</p>

<p>Delete post function in PostController:</p>

<pre><code>public function getDeletePost($post_id)
{
    $post =Post::where('id',$post_id)-&gt;first();
    $post-&gt;delete();
    return redirect()-&gt;route('dashboard')-&gt;with(['message'=&gt; 'Successfully deleted!!']);
} 
</code></pre>