简体   繁体   中英

Perform database save after Response in Laravel 5

I'd like to not hold up the client with a database save and so I'd like to do something like what is shown for Laravel 4, see below but just on one specific controller.

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

});

You can use this code:

Route::getCurrentRoute()->getActionName()

for checking which controller is performed in "App::shutdown".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM