title: How to view strings from a many-to-many relationship using blade
body: <pre><code>TableOne
  
  id|Topic
  1 |football
  2 |Rugby
  3 |Cricket
  4 |Tennis
  
  TableTwo
  
  id|name
  1 |bill
  2 |tom
  3 |Sally
  
  PivotTable
  
  id|name_id|Topic_id
  1 |2      |2
  2 |2      |3
  3 |2      |4
  4 |3      |1
  5 |1      |4
  </code></pre>
  
  <p>First of all from looking at the code below I have defined my authenticated user who is 'tom'. From the tables above I have the following code:</p>
  
  <pre><code> $authuser = Auth::User(); //tom
  
   foreach ($authuser-&gt;usersubject as $chosensubjectname)
    {
        var_dump($chosensubjectname-&gt;name);
        }
  </code></pre>
  
  <p>The code above gives me the following output when I output this to my browser:</p>
  
  <pre><code>string(5) "Rugby"  string(7) "Cricket"  string(6) "Tennis"
  </code></pre>
  
  <p>As you can see this is not an array and so im unsure how to split these 3 sets of strings. Can anyone please tell me how to output this in blade not as a collection. I mean one topic at a time. I only want to display just one of my choosing. E.g. just 'Rugby'. (Laravel 4.2)</p>
  
  <p>By the way the code below defines the many-to-many relationship between TableOne and TableTwo.</p>
  
  <pre><code> public function usersubject(){
          return $this-&gt;belongsToMany('SubjectList', 'subjectlists_user', 'name_id', 'Topic_id');
  }
  </code></pre>
  
  <p>thanks in advance</p>