title: How to access the value without foreach in PHP/Laravel?
body: <p>In my PHP code, I noticed that I can access my value only with a foreach. Can anyone explain why? </p>
  
  <pre><code>return view('pages.temp_page_course', [
          'page' =&gt; $this-&gt;course($slug),
      ]);
  
  
  public function course($slug)
  {
      $course = Course::where('slug', $slug)-&gt;get();
      return $course;
  }
  </code></pre>
  
  <p>With this code, I can access the value.</p>
  
  <pre><code>@foreach($page as $key =&gt; $course)
      {{ $course-&gt;title }}
  @endforeach
  </code></pre>
  
  <p>How do I access the value without doing a foreach?</p>
  
  <p>Thank you very much</p>