title: Laravel - How to setup a morphOne relationship
body: <p>I'm trying to implement a morphable table for categories, right now I've the following.</p>
  
  <pre><code>// Snippet Table
  - id
  - title
  - body
  
  // Post Table
  - id
  - title
  - body
  
  // Category Table
  - id
  - name
  </code></pre>
  
  <p>I want to be able to morph the posts and snippets to have only one category, something like this:</p>
  
  <pre><code>// Categorizable Table
  - category_id
  - categorizable_id
  - categorizable_type
  </code></pre>
  
  <p>Do I have to have another model for this categorizable table? Or there is a way to set it without another model? </p>
  
  <p>So far I have this</p>
  
  <pre><code>class Snippet extends Model
  {
      public function category()
      {
          return $this-&gt;morphOne(Category::class, 'categorizable');
      }
  }
  
  class Post extends Model
  {
      public function category()
      {
          return $this-&gt;morphOne(Category::class, 'categorizable');
      }
  }
  
  class Category extends Model
  {
      public function categorizable()
      {
          return $this-&gt;morphTo();
      }
  }
  </code></pre>
  
  <p>And I have 4 tables, <code>snippets</code>, <code>posts</code>, <code>categories</code>, <code>categorizables</code>, the last one the migration looks like this.</p>
  
  <pre><code>Schema::create('categorizables', function (Blueprint $table) {
      $table-&gt;increments('id');
      $table-&gt;unsignedInteger('category_id');
      $table-&gt;morphs('categorizable');
      $table-&gt;timestamps();
  });
  </code></pre>
  
  <p>The thing is, what is the correct way to save this relationship, I'm testing it on tinker and both<code>attach($category_id)</code> and <code>sync($category_id)</code> aren't saving the relationship they return the error <code>BadMethodCallException with message 'Call to undefined method Illuminate\Database\Query\Builder::categorizable()'</code>, What I'm missing?</p>