A Vue Model statistics dashboard for Laravel

Laravel Model Stats

Model statistics dashboard for your Laravel Application.

This Laravel packages gives you a statistic dashboard for you Laravel application. Think of it as a light version of Grafana, but built-in your Laravel application, and much easier to get started with. No code knowledge is required to use Laravel Model Stats, users can do everything from the web interface.


Installation

You can install the package via composer:

composer require jhumanj/laravel-model-stats

You can install the package and run the migrations with:

php artisan model-stats:install
php artisan migrate

Available Widgets

Different type of widgets (daily count, daily average, etc.) are available. When creating a widget, you choose a Model, an aggregation type and the column(s) for the graph. You can then resize and move the widgets around on your dashboard.

The aggregation types currently available:

  • Daily Count (Number of records per day. Date can be anything: created_at,updated_at,custom_date...)
  • ... (more to come soon)

Dashboard Authorization

The ModelStats dashboard may be accessed at the /stats route. By default, you will only be able to access this dashboard in the local environment. Within your app/Providers/ModelStatsServiceProvider.php file, there is an authorization gate definition. This authorization gate controls access to ModelStats in non-local environments. You are free to modify this gate as needed to restrict access to your ModelStats installation:

/**
 * Register the ModelStats gate.
 *
 * This gate determines who can access ModelStats in non-local environments.
 *
 * @return void
 */
protected function gate()
{
    Gate::define('viewModelStats', function ($user) {
        return in_array($user->email, [
            'taylor@laravel.com',
        ]);
    });
}

Upgrading

Be sure to re-publish the front-end assets when upgrading ModelStats:

php artisan model-stats:publish

GitHub

https://github.com/JhumanJ/laravel-model-stats