質問編集履歴
1
具体的なソースを記述
title
CHANGED
File without changes
|
body
CHANGED
@@ -16,4 +16,24 @@
|
|
16
16
|
in Macroable.php line 74
|
17
17
|
at CompilerEngine->handleViewException(object(BadMethodCallException), 0)
|
18
18
|
in PhpEngine.php line 44
|
19
|
+
```
|
20
|
+
|
21
|
+
```PHP
|
22
|
+
コントローラ該当箇所
|
23
|
+
public function index($categoryid) {
|
24
|
+
$users = new Users();
|
25
|
+
$userdatas = $users->getDataByCategoryid($categoryid);
|
26
|
+
view('userlist', ['userdatas' => $userdatas]);
|
27
|
+
}
|
28
|
+
モデル該当箇所
|
29
|
+
public function getDataByCategoryid($categoryid) {
|
30
|
+
$query = DB::table($this->table);
|
31
|
+
$query->where('categoryid', $categoryid);
|
32
|
+
$query->orderby('updated_at', 'desc');
|
33
|
+
$query->paginate(3);
|
34
|
+
$results = $query->get();
|
35
|
+
return $results;
|
36
|
+
}
|
37
|
+
ビュー該当箇所
|
38
|
+
{{ $userdatas->links() }}
|
19
39
|
```
|