0

Laravel Model Stats

Build UI Dashboards For Your Laravel Application.

Model Stats for Laravel is a package that gives you a statistics dashboard for your 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 coding 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

  • Multiple data aggregation types the user can select:
    • Daily Count (Number of records per day).
    • Cumulated Daily Count (Total number of records since beginning, every day).
    • Period Total (Number of new records during the selected period).
    • More planned…
  • Drag and drop and resize widgets
  • Configurable authorization gate for non-local access to the dashboard

For each widget type, the date can be any column: created_at,updated_at,custom_date.

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',
        ]);
    });
}

You can learn more about this package, get full installation instructions, and view the source code on GitHub.