在Laravel 5中的响应之后执行数据库保存

时间:2015-10-11 18:14:59

标签: php laravel httpresponse laravel-5.1

我不想用数据库保存来阻止客户端,所以我想做一些类似于Laravel 4, see below但只在一个特定控制器上显示的内容。

App::shutdown(function($request, $response)
{
    // after response to client
    App\SearchLog::create($request->all());

});

1 个答案:

答案 0 :(得分:1)

您可以使用此代码:

Route::getCurrentRoute()->getActionName()

用于检查在" App :: shutdown"。

中执行的控制器