app/Http/Controllers/admin/UsersController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index(Request $request)
    {   
        $search = $request -> input('search','');  
        $data = Users::where('username','like','%'.$search.'%')->paginate(8)->appends($request->input());
        $count = DB::table('jc_users')->whereNull('deleted_at')->count();
        return view('admin.users.index',['data'=>$data,'count'=>$count,'title'=>'用户列表']);
    }
public function index ( Request $ request ) { $ search = $ request -> input ( 'search' , '' ) ; $ data = Users :: where ( 'username' , 'like' , '%' . $ search . '%' ) -> paginate ( 8 ) -> appends ( $ request -> input ( ) ) ; $ count = DB :: table ( 'jc_users' ) -> whereNull ( 'deleted_at' ) -> count ( ) ; return view ( 'admin.users.index' , [ 'data' => $ data , 'count' => $ count , 'title' => '用户列表']); }
Display a listing of the resource.
Display a listing of the resource .
//获取请求的参数,也就是说需要搜索额参数 //表示如果有值就进行搜索,没有值就为空 //设置查询数据库中的信息 //设置计算数据表中所有信息的数量 //用户列表