title: Get grandchildren to model with Laravel eloquent
body: <p>I have following model
  Type-&gt;Categories-&gt;Task</p>
  <p>Where Categories Can belong to different Types.
  Here I use morphTo in the Category Model</p>
  <p><strong>Category Model</strong></p>
  <pre><code>class Category extends Model {
  
  
  public function categorize(){
      return $this-&gt;morphTo();
  }
  public function tasks(){
      return $this-&gt;belongsToMany(Task::class,'task_category');
  }
  public function types(){
      return $this-&gt;belongsTo(Type::class);
  }
  }
  </code></pre>
  <p>And in Types I use morphMany</p>
  <pre><code>class Type extends Model
  {
      //
      protected $fillable = [
          'slug'
      ];
      public function categories(){
          return $this-&gt;morphMany(Category::class,'categorize');
      }
      public function project(){
          return $this-&gt;belongsTo(Project::class);
      }
     /*  public function tasks(){
          return $this-&gt;hasManyThrough(
              Task::class,
              Category::class,
  
          );
      } */
  }
  </code></pre>
  <p>This works as intended but I don't know how I within the taskcontroller could get all tasks depending on type and with all the categories, through the type model. I tried <code>hasManyThrough</code> but it doesn't work, since tasks and categories are related through a pivot table.</p>
  <p>Currently I have</p>
  <p><code>$type = Type::with('categories')-&gt;where('slug', $type)-&gt;first();</code></p>
  <p>this gets me the type with categories, but as mentioned before I'd like to get associated tasks under each category object.
  If something is unclear I'll be happy to clearify and correct whatever is need. All help is very much appreciated.</p>