我的中间件类似于Auth.它检查URL模式(例如:/ rest/*),然后在请求中查找令牌,从数据库中检索其对应的用户.之后,我想将该用户保存在变量中,以便稍后可以在以下任何控制器中返回它.什么是最好的方式?
中间件:
public function handle($request, Closure $next)
{
$token = Input::get("token");
// get user data from database
$user = User::get_user_from_token($token);
// ?? -> How to pass $user to controller, so that ..
return $next($request);
}
Run Code Online (Sandbox Code Playgroud)
在控制器中:
public function profile_save() {
// I get the user back here without querying again
$user = ???
}
Run Code Online (Sandbox Code Playgroud) 使用 Google Adwords 脚本,您可以创建如下所示的广告组 - https://developers.google.com/adwords/scripts/docs/examples/ad-groups。但是没有关于如何创建活动的参考。
如何使用 Google Adwords 脚本制作新广告系列?