php - Laravel:在刀片内调用 paginate()?
问题描述
我可以访问$files
我的刀片内部调用的集合。我正在分页并将其设置为$allFiles
.
<?php $allFiles = $files->paginate(12); ?>
在下面的刀片中,当我调用时:
<div>
{{ $allFiles->links() }}
</div>
,我收到错误消息call to a member function links() on array
。我不确定我做错了什么。
编辑:添加更多信息并显示是什么$allFiles
。我将其记录在我的代码中并在下面添加:
Object
(
[collection:protected] => App\Models\Collection Object
(
[connection:protected] => data
[table:protected] => collections
[timestamps] => 1
[fillable:protected] => Array
(
[0] => title
[1] => content
)
[casts:protected] => Array
(
[smart_collection] => boolean
[is_app_collection] => boolean
)
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[id] => 2
[title] => Test
)
[original:protected] => Array
(
[id] => 2
[title] => Test
)
[dates:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[events:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
)
[resultsCount:protected] => 19
[resultsProducts:protected] =>
[cache:protected] => Array
(
)
[splitOption:protected] =>
[context:protected] =>
)
解决方案
推荐阅读
- html - 无法将锚标记放在 HTML 代码标记内
- xamarin - 我有一个 Xamarin 形式的 MultiTrigger,对于一个按钮,它不起作用
- json - SQL Server sp_OAMethod 在调用 WebAPI 时返回 NULL
- google-apps-script - 如何从 AppMaker 中的 Query 对象中获取排序字段和顺序?
- regex - 使用正则表达式随机大写
- python - Requests / Asyncio:使用 Python 请求会话使 pool_maxsize=1000 有缺点吗?
- node.js - 节点:无法模拟 aws-sdk 方法
- r - 在 Matrix::qr 方法中获取 base::qr 旋转
- javascript - 在 JS (ES3) 上返回带有对象上下文的对象方法
- c# - 如何在不指定类型的情况下调用泛型类的静态方法?