当前位置:网站首页>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);边栏推荐
- Vivado HLS introductory notes
- Multi thread learning v. volatile visibility and cache inconsistency, instruction reordering
- 深入理解异步编程
- Object class not ended
- Redis cluster cluster capacity expansion and data migration
- arp timer and arptables
- 什么是工程预付款
- merge sort
- Towards End-to-End Lane Detection: an Instance SegmentationApproach
- Go interface oriented programming practice
猜你喜欢

16. 最接近的三数之和

个人申请OV类型SSL证书

4.3 simulate browser operation and page waiting (display waiting and implicit waiting, handle)

FPGA语法的细节

Abstract methods and interfaces

Deep understanding of asynchronous programming

Matlab: halftone and dither conversion

Why should state-owned enterprises go public

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

Beginning is an excellent emlog theme v3.1, which supports emlog Pro
随机推荐
4.3 simulate browser operation and page waiting (display waiting and implicit waiting, handle)
Matlab: halftone and dither conversion
Detailed analysis of the 2021 central China Cup Title A (color selection of mosaic tiles)
Vivado HLS introductory notes
Lesson 5: data warehouse construction (III)
Detailed explanation of data envelopment analysis (DEA) (taking the 8th Ningxia provincial competition as an example)
Performance test - Analysis of performance test results
Details of FPGA syntax
29. print matrix clockwise
Platform of ASoC framework driven by alsa
Please remove any half-completed changes then run repair to fix the schema history
Tkinter uses webview2 web component (sequel)
GRE protocol details
Matlab: image rotation and interpolation and comparison of MSE before and after
How does WiFi 802.11 correspond to 802.3
@Configurationproperties value cannot be injected
How Wireshark decrypts WiFi data packets
What is thinking
Selenium crawler automatically captures TOEFL test position of NEEA website
Detailed usage of vim editor