Skip to content
Stores the last activity time of users within your Laravel application
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Laravel Last Activity

Stores the last activity time of users within your Laravel application


To install the Laravel Last Activity package, just run the following Composer command from the root of your project.

composer require divineomega/laravel-last-activity


This package requires you to register middleware within your app\Http\Kernel.php file. You will need add the middleware to every middleware group you wish to monitor activity for, as shown below.

protected $middlewareGroups = [
        'web' => [
            /* ... other web middleware ... */

        'api' => [
            /* ... other api middleware ... */

You also need to add the config file and migration to your project. To do so, simply run the following Artisan command.

php artisan vendor:publish --provider="DivineOmega\LaravelLastActivity\ServiceProvider"

You can then run the provided migration to add a last_activity field to your users table.

php artisan migrate

That's it. The last_activity field within your users will be automatically updated whenever the user interacts with your application via the web or API.

Alternative field name

If you do not wish to use last_activity as the field name, this can be changed in the provided migration. You will also need to alter the configuration file

The published configuration file for this package can be found at config/last-activity.php.


return [
    // Field in which the last activity date time will be stored.
    'field' => 'last_activity',
You can’t perform that action at this time.