Laravel clean code: count relation based on a query

Поделиться
HTML-код
  • Опубликовано: 28 дек 2024

Комментарии • 3

  • @bolence79
    @bolence79 Месяц назад +1

    What is a difference between withCount and loadCount?

    • @laravelboy
      @laravelboy  Месяц назад +1

      generally load() is for single model
      User::find()->load('posts')
      but with() is for more than one model
      User::with('posts')->get() .....

  • @aogunnaike
    @aogunnaike Месяц назад

    Thanks