title: Laravel: query a model with count
body: <p>how can query in laravel with model method ?
  i have a counter method in city model and i want to use this in my select query in response</p>
  <p>how can i write this ?</p>
  <p>my City model</p>
  <pre><code>public function mobile()
  {
      return $this-&gt;hasMany(Mobile::class);
  }
  
  public function mobile_count()
  {
      return $this-&gt;mobile()-&gt;count();
  }
  </code></pre>
  <p>my query</p>
  <pre><code>public function findCityWithID($id)
  {
      $subgroup = City::select('id', 'name', 'state_id')-&gt;where('state_id', $id)-&gt;orderBy('name')-&gt;get();
      return response()-&gt;json($subgroup);
  }
  </code></pre>
  <p>i want have in $subgroup each City mobile counts</p>