Syntax for calling child relationship with a condition on the parent in Laravel
<p>I have a model called 'Tag' which has a self-referencing 'hasMany' relationship on itself. So for example I have a tag called UK and this 'has many' child tags called London, Liverpool, Manchester etc.</p>

<p>Here is the relationship in the Tag model file:</p>

<pre><code>public function children()
{
    return $this-&gt;hasMany('App\Tag', 'tag_parent');
}
</code></pre>

<p>I simply want to get the list of child cities from the parent 'UK' tag. So I have this code:</p>

<pre><code>$cities = Tag::where('title', 'UK')-&gt;get()-&gt;children;
</code></pre>

<p>I am getting an error saying children is unknown. The docs say I should do this which works as expected. </p>

<pre><code>$cities = Tag::find($id)-&gt;children;
</code></pre>

<p>So how do I get that list of child cities with the 'where' condition? I thought Tag::find($id) was just a shortcut for Tag::where('id', $id)->get()?</p>

<p><strong>UPDATE</strong></p>

<p>Exact error:</p>

<pre><code>ErrorException in TagController.php line 28:
Undefined property: Illuminate\Database\Eloquent\Collection::$children
</code></pre>