orderBy does not exist 跪求解答
$posts = Tag::find($tag)->posts ->where('published_at', '<=', Carbon::now()->addHour(8))
->orderBy('published_at', 'desc')
->paginate('10');
为什么我加了“->orderBy()和->paginate(‘10’);”
就会报错Method Illuminate\Database\Eloquent\Collection::orderBy does not exist.
如果不加“->orderBy()和->paginate(‘10’);” 就不会报错
看了文档也是这样写的,新手跪求大哥指导。
推荐文章: