title: Passing posts view id to another controller so I can access table records in Laravel
body: <p>So I got posts page, where I have my post. The post has ID which leads to posts table. For it I have PostsController where everything is accessible thru $post->id, $post->name etc.</p>
  
  <p>But I have another table named orders and on submit button, it needs some of the information from posts table by id.</p>
  
  <p><a href="https://i.stack.imgur.com/skmF6.png" rel="nofollow noreferrer">I have post with url posts/{id} and there's submit button in the view </a></p>
  
  <p>The button needs to get $post information to OrdersController with submit information.</p>
  
  <p>I've tried this in OrdersController </p>
  
  <pre><code>    public function store(Request $request)
  {
      $this-&gt;validate($request, [
      ]);
  
      $post = Post::all();
      $order = new Order;
      $order-&gt;client = Auth::user()-&gt;name;
      $order-&gt;phone = Auth::user()-&gt;phone;
      $order-&gt;vehicle = $post-&gt;id;
      $order-&gt;date_from = $request-&gt;input('date_from');
      $order-&gt;save();
  
      return redirect('/posts')-&gt;with('success', 'Rezervēts');
  }
  </code></pre>
  
  <p>$posts = Post::all(); is getting all array information from table but cannot use specific id.</p>
  
  <p>And I have this in PostsController </p>
  
  <pre><code>   public function show($id)
      {
          $post = Post::find($id);
          $images = Image::All();
          return view('posts.show')-&gt;with(compact('post', 'images'));
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/4dMlk.png" rel="nofollow noreferrer">Route for show function</a></p>
  
  <p>Error that I'm getting with shown code: Property [id] does not exist on this collection instance.</p>
  
  <p>Expected results:
  <a href="https://i.stack.imgur.com/j4JOH.png" rel="nofollow noreferrer">orders table</a></p>
  
  <p>Error: Property [id] does not exist on this collection instance.
  Problem: Can't get exact id from view to another controller, so I can access posts table records that I need from OrdersController.</p>
  
  <p>Ps. I've been thru most of the pages on this error, but can't seem to find the one that would help.</p>