title: Get data from polymorphic relations with namespaces
body: <p>I have a comments table that have comments of articles, recipes and products. So its a <code>polymorphic</code> relation. I have two columns <code>rel_id and rel_type</code> in my comments table those are being used for this relation. </p>
  
  <p>Now in my <code>Comment.php</code> I have following relation</p>
  
  <pre><code>public function rel()
  {
      $this-&gt;morphTo();
  }
  </code></pre>
  
  <p>And in my other all classes I have following</p>
  
  <pre><code>public function comments()
  {
      return $this-&gt;morphMany('App\Models\Comment', 'rel');
  }
  </code></pre>
  
  <p>When I try to get owner of comment and all its related data I found class not found error. For example</p>
  
  <pre><code>$comments = Comment::find(1);
  echo $comments-&gt;rel_type //article
  </code></pre>
  
  <p>Now if I want to get data of article and when I try </p>
  
  <pre><code>$comments-&gt;rel
  </code></pre>
  
  <p>I found <code>article class not found</code>. I am using namespace <code>App\Models\Article</code> I have searched it out I found answer given <a href="https://stackoverflow.com/questions/27866020/laravel-returning-the-namespaced-owner-of-a-polymorphic-relation">here</a>. When I try accepted answer, nothing happens, error remains same. When I try second answer of same question, I found</p>
  
  <pre><code> Relationship method must return an object of type Illuminate\Database\Eloquent\Relations\Relation 
  </code></pre>
  
  <p>My ultimate goal is to get comment owner data like $comments->articles->id and so on. Please guide how can I do that?</p>