Laravel Eloquent with and find

后端 未结 4 1950
孤城傲影
孤城傲影 2020-12-30 18:54

Why is this not working?

Article::with(\'category\')->find($ids)

I got a Array to String Conversion Exception.

But if i split t

4条回答
  •  时光说笑
    2020-12-30 19:34

    Just for the posterity... other way you can do this is:

    Article::with('category')->whereIn('id', $ids)->get();
    

    This should be better (more performant), because it's leaving the query to the database manager

提交回复
热议问题