I can not find any information on protected $withCount = []; property in eloquent models.
It should append relation count to attributes but it totally crashes my site. It skips laravel's error handler and throws error 500 in browser. Tinker quits immediately.
This is an example of how I used it:
class Post extends Model {
protected $withCount = ['comments'];
public function comments()
{
return $this->hasMany(Comment::class);
}
}
Btw, withCount() query builder's method works just fine.