一、PDO预处理
- laravel发送给mysql的语句 - toSql()
public function orwhere(){
// $res = DB::table('admin')->where('gid',0)->orWhere('ispasswd',1)->get(['id','username','real_name']);
$res = DB::table('admin')->where('gid',0)->orWhere('ispasswd',1)->toSql();
echo '<pre>';
print_r($res);
}

二、连表查询

// 连表查询
public function join(){
$res = DB::table('admin')->join('admin_group','admin.gid','=','admin_group.gid')->get();
echo '<pre>';
print_r($res);
}

三、中间件

<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Closure;
// 中间件
class Mycheck{
public function handle(Request $request,Closure $next){
$a = 3;
$b = 5;
echo 'a+b='.($a+$b);
return $next($request);
}
}

Route::get('/home/join','Home@join')->middleware('mycheck');

// 中间件
class Mycheck{
public function handle(Request $request,Closure $next){
$a = 3;
$b = 5;
echo 'a+b='.($a+$b);
return response('aaa',200);
return $next($request);
}
}
