$keyword=$request->input();
$list = DB::table("user as a")
->leftJoin('students as b', 'b.id', '=', 'a.sid')
->where(function($query) use($keyword) {
if(!empty($keyword["keyword"])){
$name=$keyword["keyword"];
$query->Where('user_name','like',"%$name%");
$query->orWhere('alias_name','like',"%$name%");
$query->orWhere('mobile','like',"%$name%");
}
})
->where(function($query) use($keyword) {
if(!empty($keyword["mid"])){
$query->where('mid',$keyword["mid"]);
}
})
->select(['b.*',,'b.id as b_id','a.*','a.id as a_id','a.name as a_name','b.name as b_name'])
->orderBy("a.id","desc")
->paginate(15);