/laravel-model-stats

Model statistics dashboard for your Laravel Application

Primary LanguageVueMIT LicenseMIT

Laravel Model Stats

Model statistics dashboard for your Laravel Application

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads


https://ibb.co/4SJJSsw

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 Aggregation Types

Different type of aggregation types (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.

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

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits (Contributors)

Inspiration

  • Grafana: for the dashboard/widget aspect
  • Laravel Telescope: for many things in the package structure (front-end, authorization...)

License

The MIT License (MIT). Please see License File for more information.