質問編集履歴
1
Route,Controllerを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -53,3 +53,53 @@
|
|
53
53
|
select * from `tests` where `syubetu_name` LIKE '%\u30c6\u30ec\u30d3%'
|
54
54
|
|
55
55
|
```
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
Route
|
60
|
+
|
61
|
+
```php
|
62
|
+
|
63
|
+
Route::post('/search', 'testController@search');
|
64
|
+
|
65
|
+
```
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
Controller
|
70
|
+
|
71
|
+
```php
|
72
|
+
|
73
|
+
use Input;
|
74
|
+
|
75
|
+
use Illuminate\Http\Request;
|
76
|
+
|
77
|
+
use Illuminate\Support\Facades\DB;
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
class testController extends Controller
|
82
|
+
|
83
|
+
{
|
84
|
+
|
85
|
+
public function search(Request $request)
|
86
|
+
|
87
|
+
{
|
88
|
+
|
89
|
+
$listpart = DB::table('tests');
|
90
|
+
|
91
|
+
$s_syubetu = $request->input('s_syubetu');
|
92
|
+
|
93
|
+
$listpart->where('syubetus.syubetu_name', 'LIKE', '\'%'.$s_syubetu.'%\'');
|
94
|
+
|
95
|
+
$listpart = $listpart->orderBy('updated_at', 'desc')
|
96
|
+
|
97
|
+
->take(30)
|
98
|
+
|
99
|
+
->get();
|
100
|
+
|
101
|
+
}
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
```
|