当前位置:网站首页>The select option in laravel admin contains a large amount of data
The select option in laravel admin contains a large amount of data
2022-06-26 04:21:00 【Scholar and】
Common use :
// Gender 1- male 2- Woman
$form->select('sex', ' Gender ')->options([1 => ' male ', 2 => ' Woman '])->default(1);
Search input box :( Contains a lot of data , Not suitable for one-time request insertion )
routes Definition :
$router->get("select_name", 'Test\[email protected]')->name('select_name');
filter , Use in form :
$form->select('name', ' full name ')->options()->ajax('/select_name');
Interface :
// Search for user name
public function selectName(Request $request) {
//select Box to enter the content ( User name ),q It is a fixed value and does not need to be changed
$name = $request->input('q');
if ($name == '') return response()->json([]);
// Query results
$list = DB::where('name', 'like', '%' . $name . '%')
->paginate(null, ['id', 'name'])
->toArray();
return response()->json($list);
}
Query results $list Data type of :
/* array (size=12) 'current_page' => int 1 'data' => array (size=15) 0 => array (size=2) 'id' => int 1 'text' => string ' Zhang 1' (length=20) 1 => array (size=2) 'id' => int 2 'text' => string ' Zhang 2' (length=21) ... 14 => array (size=2) 'id' => int 15 //text Don't change 'text' => string ' Zhang 15' (length=24) 'first_page_url' => string 'http://test.cn/select_name?page=1' (length=51) 'from' => int 1 'last_page' => int 390 'last_page_url' => string 'http://test.cn/select_name?page=390' (length=53) 'next_page_url' => string 'http://test.cn/select_name?page=2' (length=51) 'path' => string 'http://test.cn/select_name' (length=44) 'per_page' => int 15 'prev_page_url' => null 'to' => int 15 'total' => int 5848 */
边栏推荐
- Laravel framework Alipay payment fails to receive asynchronous callback request [original]
- Development trend and prospect forecast report of China's financial industry 2022-2028 Edition
- 1064 (42000) error occurred when installing MySQL and modifying root password
- Which is the best embedded visual programming software? (introduction, evaluation and selection of visual programming platform) [scratch, mind+, mixly]
- Tp6 is easy to tread [original]
- mysql自帶的性能測試工具mysqlslap執行壓力測試
- MySQL's built-in performance testing tool, mysqlslap, performs stress testing
- In the matter of getting customers at sea, how can advertisers play besides digital advertising?
- Add, delete, modify and query curd in PHP native SQL
- Question brushing record day01
猜你喜欢

Understand CGI and fastcgi

小程序中实现视频通话及互动直播功能

How does virtual box virtual machine software accelerate the network speed in the virtual system?

Zeromq from getting started to mastering

Conditional variables for thread synchronization

How to use EEPROM in 51 Single Chip Microcomputer?

MySQL index details
![[Qunhui] this suite requires you to start PgSQL adapter service](/img/fb/1aea7eb833afc1a24531b612a98400.jpg)
[Qunhui] this suite requires you to start PgSQL adapter service

SixTool-多功能多合一代挂助手源码

修改Oracle连接数
随机推荐
Fastadmin always prompts sqlstate[23000]: integrity constraint violation: 1052 column 'ID' in order clause is am
How to use EEPROM in 51 Single Chip Microcomputer?
Tencent Interviewer: How did binder get its system services?
In 2022, what professional competitions can college students majoring in automation, electrical engineering and automation participate in?
Swagger
2021/11/6-burpsuit packet capturing and web page source code modification
Gateway can not connect to tcp://127.0.0.1: Connection refused
How much do you make by writing a technical book? To tell you the truth, 2million is easy!
Minecraft 1.16.5 生化8 模组 1.9版本 1.18版本同步
Understand CGI and fastcgi
Install dbeaver and connect Clickhouse
PHP has the problem of using strtotime to obtain time in months and months [original]
Resolve PHP is not an internal or external command
Nailing open platform - applet development practice (nailing applet server side)
35岁程序员炒Luna 千万资产3天归零,网友:和赌博一样
Zeromq from getting started to mastering
2021-01-31
微软禁止俄用户下载安装Win10/11
What should I do if I don't understand the precious metal indicators
Analysis report on the development trend and operation status of China's environmental monitoring instrument industry from 2022 to 2028