title: Solve "Missing required parameters for [Route: post.show] [URI: post/show/{id}]."
body: <p>Basically, I want to solve this error </p>
  
  <blockquote>
    <p>Missing required parameters for [Route: post.show] [URI: post/show/{id}]. (View: C:\xampp2\htdocs\galaxall\resources\views\index.blade.php)</p>
  </blockquote>
  
  <p>I am trying to make a system on my site whereby users can post,view post comment on posts and reply.</p>
  
  <p>When a usertypes the details of his post in <code>http://localhost:8000/post/create</code>,it is supposed to accept the values,insert it into the database and redirect to <code>http://localhost:8000/posts/show</code> and show a the list of posts ever 'posted' so that the user can view a post can comment and reply to comments about that post.</p>
  
  <p>BUT 
  what currently happens is that after typing the details for the to-be post in 
  <code>http://localhost:8000/post/create</code>,it inserts into the db and then shows this error on laravel 'customised' error page:</p>
  
  <blockquote>
    <p>Missing required parameters for [Route: post.show] [URI: post/show/{id}]. (View: C:\xampp2\htdocs\galaxall\resources\views\index.blade.php)</p>
  </blockquote>
  
  <p>I have no clue what I'm doing wrong.</p>
  
  <p>Please help</p>
  
  <p>These are my code:</p>
  
  <p><strong>PostController.php</strong></p>
  
  <pre><code>    &lt;?php
  
  // PostController.php
  
  namespace App\Http\Controllers;
  use App\Post;
  use Illuminate\Http\Request;
  use Auth;
  use Stevebauman\Location\Facades\Location;
  
  class PostController extends Controller
  {
      protected $fillable = [
          'Uploader',
          ];
  
      public function __construct()
      {
          return $this-&gt;middleware('auth');
      }
  
      public function create()
      {
          return view('post');
      }
  
      public function store(Request $request)
      {
          {
  
  
              $post =  new Post;
  
              $post-&gt;title = $request-&gt;get('title');
              $post-&gt;type = $request-&gt;get('type');
              $post-&gt;description = $request-&gt;get('description');
              $post-&gt;body = $request-&gt;get('body');
              $post-&gt;UniqueId = str_random(16);
              $post-&gt;Uploader = Auth::user()-&gt;name;
              $post-&gt;Language = 'en';
              $post-&gt;Location=Location::get()-&gt;countryCode;            
              $post-&gt;views = 0;
              $post-&gt;Applauds = 0;
              $post-&gt;Boos = 0;
              $post-&gt;Tags =  "hey";
  
                           if ($request-&gt;get('agegroup')) {
                              $post-&gt;agegroup = $request-&gt;get('agegroup');
                           } else {
                              $post-&gt;agegroup ='undefined';
                           }
  
              $post-&gt;AllowComments = 'true';
              $post-&gt;CommentsBg = 'default';
              $post-&gt;Visibility = 'globally public';
              $post-&gt;others = 'embeddable';
  
  
              $post-&gt;save();
  
              return redirect('posts');
  
          }
      }
  
     public function index()
     {
      $posts = Post::all();
  
      return view('index', compact('posts'));
     }
  
     public function show($id)
     {
      $post = Post::find($id);
  
      return view('show', compact('post'));
     }
  }
  </code></pre>
  
  <p><strong>CommentController.php</strong></p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use App\Comment;
  use App\Post;
  
  class CommentController extends Controller
  {
      public function store(Request $request)
      {
          $comment = new Comment;
          $comment-&gt;body = $request-&gt;get('comment_body');
          $comment-&gt;user()-&gt;associate($request-&gt;user());
          $post = Post::find($request-&gt;get('post_id'));
          $post-&gt;comments()-&gt;save($comment);
  
          return back();
      }
  }
  </code></pre>
  
  <p><strong>Web.php</strong>
      
  
  <pre><code>/*
  |--------------------------------------------------------------------------
  | Web Routes
  |--------------------------------------------------------------------------
  |
  | Here is where you can register web routes for your application. These
  | routes are loaded by the RouteServiceProvider within a group which
  | contains the "web" middleware group. Now create something great!
  |
  */
  
  Route::get('/', function () {
      return view('welcome');
  });
  
  Auth::routes();
  
  
  Route::get('logout', '\App\Http\Controllers\Auth\LoginController@logout');
  Route::get('/home', 'HomeController@index')-&gt;name('home');
  Route::get('/admin', 'AdminController@index')-&gt;name('admin');
  Route::get('/upload', 'UploadController@index')-&gt;name('upload');
  
  Route::get('/post/create', 'PostController@create')-&gt;name('post.create');
  Route::post('/post/store', 'PostController@store')-&gt;name('post.store');
  
  Route::get('/posts', 'PostController@index')-&gt;name('posts');
  Route::get('/post/show/{id}', 'PostController@show')-&gt;name('post.show');
  
  Route::post('/comment/store', 'CommentController@store')-&gt;name('comment.add');
  Route::post('/reply/store', 'CommentController@replyStore')-&gt;name('reply.add');
  
  Route::match(['get', 'post'], 'imageupload', 'ImageController@Image');
  Route::delete('delimage/{filename}', 'ImageController@Image');
  </code></pre>
  
  <p><strong>post.blade.php</strong></p>
  
  <pre><code>@extends('layouts.app')
  
  @section('content')
  &lt;div class="container"&gt;
      &lt;div class="row justify-content-center"&gt;
          &lt;div class="col-md-8"&gt;
              &lt;div class="card"&gt;
                  &lt;div class="card-header"&gt;Create Post&lt;/div&gt;
                  &lt;div class="card-body"&gt;
                      &lt;form method="post" action="{{ route('post.store') }}"&gt;
                          &lt;div class="form-group"&gt;
                              @csrf
                              &lt;label class="label"&gt;Post Title: &lt;/label&gt;
                              &lt;input type="text" name="title" class="form-control" required/&gt;
                          &lt;/div&gt;
                          &lt;label class="label"&gt;Post Type &lt;/label&gt;
                          &lt;input type="text" name="type" class="form-control" required/&gt;
  
                           &lt;label class="label"&gt;Tags &lt;/label&gt;
                          &lt;input type="text" name="tags" class="form-control" required/&gt;
  
                          &lt;label class="label"&gt;Age-group(optional) &lt;/label&gt;
                          &lt;input type="text" name="agegroup" class="form-control" required/&gt;
  
  
                          &lt;div class="form-group"&gt;
                              &lt;label class="label"&gt;Post Description &lt;/label&gt;
                              &lt;textarea name="description" rows="5" cols="20" class="form-control" required&gt;&lt;/textarea&gt;
                          &lt;/div&gt;
  
                          &lt;div class="form-group"&gt;
                              &lt;label class="label"&gt;Post Body: &lt;/label&gt;
                              &lt;textarea name="body" rows="10" cols="30" class="form-control" required&gt;&lt;/textarea&gt;
                          &lt;/div&gt;
                          &lt;div class="form-group"&gt;
                              &lt;input type="submit" class="btn btn-success" /&gt;
                          &lt;/div&gt;
                      &lt;/form&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  @endsection
  </code></pre>
  
  <p><strong>show.blade.php</strong></p>
  
  <pre><code>&lt;!-- show.blade.php --&gt;
  
  @extends('layouts.app')
  
  @section('content')
  &lt;div class="container"&gt;
      &lt;div class="row justify-content-center"&gt;
          &lt;div class="col-md-8"&gt;
              &lt;div class="card"&gt;
                  &lt;div class="card-body"&gt;
                      &lt;p&gt;&lt;b&gt;{{ $post-&gt;title }}&lt;/b&gt;&lt;/p&gt;
                      &lt;p&gt;
                          {{ $post-&gt;body }}
                      &lt;/p&gt;
                      &lt;hr /&gt;
                      &lt;h4&gt;Display Comments&lt;/h4&gt;
                      @foreach($post-&gt;comments as $comment)
                          &lt;div class="display-comment"&gt;
                              &lt;strong&gt;{{ $comment-&gt;user-&gt;name }}&lt;/strong&gt;
                              &lt;p&gt;{{ $comment-&gt;body }}&lt;/p&gt;
                          &lt;/div&gt;
                      @endforeach
                      &lt;hr /&gt;
                      &lt;h4&gt;Add comment&lt;/h4&gt;
                      &lt;form method="post" action="{{ route('comment.add') }}"&gt;
                          @csrf
                          &lt;div class="form-group"&gt;
                              &lt;input type="text" name="comment_body" class="form-control" /&gt;
                              &lt;input type="hidden" name="post_id" value="{{ $post-&gt;id }}" /&gt;
                          &lt;/div&gt;
                          &lt;div class="form-group"&gt;
                              &lt;input type="submit" class="btn btn-warning" value="Add Comment" /&gt;
                          &lt;/div&gt;
                      &lt;/form&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  @endsection
  </code></pre>
  
  <p>index.blade.php</p>
  
  <pre><code>@extends('layouts.app')
  
  @section('content')
  &lt;div class="container"&gt;
      &lt;div class="row justify-content-center"&gt;
          &lt;div class="col-md-8"&gt;
              &lt;table class="table table-striped"&gt;
                  &lt;thead&gt;
                      &lt;th&gt;ID&lt;/th&gt;
                      &lt;th&gt;Title&lt;/th&gt;
                      &lt;th&gt;Action&lt;/th&gt;
                  &lt;/thead&gt;
                  &lt;tbody&gt;
                  @foreach($posts as $post)
                  &lt;tr&gt;
                      &lt;td&gt;{{ $post-&gt;id }}&lt;/td&gt;
                      &lt;td&gt;{{ $post-&gt;title }}&lt;/td&gt;
                      &lt;td&gt;
                          &lt;a href="{{ route('post.show', $post-&gt;id) }}" class="btn btn-primary"&gt;Show Post&lt;/a&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  @endforeach
                  &lt;/tbody&gt;
  
              &lt;/table&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  @endsection
  </code></pre>