title: Fetch all the rows with same column number in laravel
body: <p>I have a modal button associated with each student on a table. When I press the button I want to be able to fetch all results associated with the admission_num from another table. The code I have is below.</p>
  <p><a href="https://i.stack.imgur.com/lIfat.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lIfat.jpg" alt="enter image description here" /></a></p>
  <p>Here is my controller code</p>
  <pre><code>public function view_student_result($id)
  {
  
      $user= User::where('admission_num', $id)-&gt;get();
      
      $resultdata = juniorResults::where('admission_num', $id)-&gt;get();
  
  
  
      return view('backend.student_result_view', compact('resultdata', 'user'));
  }
  </code></pre>
  <p>Here is my route</p>
  <pre><code>Route::get('view-student-result/{id}', [viewResultController::class, 'view_student_result'])-&gt;name('view_student_result');
  </code></pre>
  <p>Here is the button that links to the view result page</p>
  <pre><code>  &lt;a href=&quot;{{ route('view_student_result', $studentDatas-&gt;admission_num) }}&quot;&gt;&lt;i class=&quot;fas fa-print&quot;&gt;&lt;/i&gt;&lt;/a&gt;
  </code></pre>
  <p>When I used get(), I got this error <strong>Property [admission_num] does not exist on this collection instance.</strong> But when I use first() instead of get() the code was able to fetch just one result. below is the dd(collection)</p>
  <p><a href="https://i.stack.imgur.com/B8tUX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B8tUX.jpg" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/ZN3JX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZN3JX.jpg" alt="enter image description here" /></a></p>