質問編集履歴
1
namespace useを追加しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -25,6 +25,46 @@
|
|
25
25
|
```
|
26
26
|
|
27
27
|
//HelloController.php
|
28
|
+
|
29
|
+
namespace App\Http\Controllers;
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
use Illuminate\Http\Request;
|
34
|
+
|
35
|
+
use Illuminate\Http\Response;
|
36
|
+
|
37
|
+
use App\Http\Requests\HelloRequest;
|
38
|
+
|
39
|
+
use Validator;
|
40
|
+
|
41
|
+
use Illuminate\Support\Facades\DB;
|
42
|
+
|
43
|
+
use Faker\Provider\zh_CN\Person;
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
class HelloController extends Controller
|
48
|
+
|
49
|
+
{
|
50
|
+
|
51
|
+
public function index(Request $request)
|
52
|
+
|
53
|
+
{
|
54
|
+
|
55
|
+
$sort = $request->sort;
|
56
|
+
|
57
|
+
//$items = DB::table('people')->simplePaginate(5);
|
58
|
+
|
59
|
+
// ->orderBy($sort, 'asc');
|
60
|
+
|
61
|
+
$items = Person::orderBy($sort, 'asc')->simplePaginate(5);
|
62
|
+
|
63
|
+
$param = ['items' => $items, 'sort' => $sort];
|
64
|
+
|
65
|
+
return view('hello.index', $param);
|
66
|
+
|
67
|
+
}
|
28
68
|
|
29
69
|
public function index(Request $request)
|
30
70
|
|