当前位置:网站首页>Laravel8 when search
Laravel8 when search
2022-06-12 05:33:00 【Python's path to becoming a God】
// Query list
Route::get('newsList', [\App\Http\Controllers\NewsController::class, 'newsList'])->middleware(['ckadmin']); // Query list
public function usersList(Request $request){
$keywords=$request->input('keywords');
$data=Users::usersList($keywords);
return view('index/usersList',compact('data'));
} public static function usersList($keywords){
return self::when($keywords,function ($query) use ($keywords){
$query->where('username','like',"%$keywords%");
})->get();
}You cannot delete the user
// Delete data
Route::get('newsDel/{id}', [\App\Http\Controllers\NewsController::class, 'newsDel'])->middleware(['ckadmin']); // Delete data
public function usersDel($id){
$res=Users::usersDel($id);
if($res){
return redirect('usersList');
}
}// Delete data
public static function usersDel($id){
return self::destroy($id);
} @if(auth()->user()->id != $val->id)
<td><a href="{
{url('usersDel',['id'=>$val->id])}}"><button> Delete </button></a></td>
@endif
</tr>
@endforeachmiddleware
// Check whether the user is logged in
if(!auth()->check()){
return redirect('loginShow')->withErrors(' Please log in first ');
}
return $next($request);边栏推荐
- 14- II. Cutting rope II
- FPGA语法的细节
- 20000 word detailed reptile knowledge reserve, basic exercises of data collection and cleaning (I) reference answers to the first song
- Beginning is an excellent emlog theme v3.1, which supports emlog Pro
- SIM卡信号的驱动电流是多少mA,是否是可调节的?
- Stm32f4 ll library multi-channel ADC
- Calculation method notes for personal use
- Detailed analysis of the 2021 central China Cup Title A (color selection of mosaic tiles)
- merge sort
- Optipng can optimize the compressed PNG picture file format
猜你喜欢

MySQL Linux Installation mysql-5.7.24

Development of video preview for main interface of pupanvr-ui

Why should state-owned enterprises go public

Simple introduction to key Wizard

个人申请OV类型SSL证书

Computer network connected but unable to access the Internet

Automated test - dark horse headline test project

Save the object in redis, save the bean in redis hash, and attach the bean map interoperation tool class

Vivado HLS introductory notes

Stm32f4 ll library multi-channel ADC
随机推荐
A solution for PHP to implement image login verification code
Legal liabilities to be borne by the person in charge of the branch
Performance test - performance test tool analysis
Reverse linked list
DMA RDMA technology details
Multi thread learning III. classification of threads
Introduction to audio alsa architecture
yolov5
Thingsboard create RCP widget
Thingsboard view telemetry data through database
按键精灵的简单入门
Is the individual industrial and commercial door a legal person enterprise
Detailed usage of vim editor
Kubernetes certificate online update
UBI details and JFFS2 square FS UBIFS
Rv1109 lvgl UI development
Nbiot module me3616 at command mqtt connecting thingsboard
Test work summary - performance test related issues
The combined application of TOPSIS and fuzzy borde (taking the second Dawan District cup and the national championship as examples, it may cause misunderstanding, and the Dawan District cup will be up
Serial port oscilloscope_ port_ Setup of plotter secondary development environment (including QT setup)