Skip to content

blumilksoftware/laravel-heatmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Packagist PHP Version Support Packagist Version Packagist Downloads

About

blumilksoftware\laravel-heatmap is an extension of blumilksoftware\heatmap allowing you to use heatmap with Model data from Laravel Eloquent.

Installation

The Laravel Heatmap is distributed as Composer library via Packagist. To add it to your project, just run:

composer require blumilksoftware/laravel-heatmap

Usage

Creating a heatmap from Laravel Collection

You can build a heatmap directly from collection of Eloquent models:

use Blumilk\LaravelHeatmap\LaravelHeatmapBuilder;
use App\Models\YourModel;

$data = YourModel::all(); // Assuming YourModel has a 'created_at' field

$heatmapBuilder = new LaravelHeatmapBuilder();
$heatmap = $heatmapBuilder->buildFromCollection($data, 'created_at');

You can also build heatmap from array:

use Blumilk\LaravelHeatmap\LaravelHeatmapBuilder;

$data = [
    ["created_at" => "2022-11-01 00:00:00"],
    ["created_at" => "2022-11-03 00:00:00"],
    ["created_at" => "2022-11-16 00:00:00"],
    ["created_at" => "2022-11-16 00:00:00"],
    ["created_at" => "2022-11-18 00:00:00"],
    ["created_at" => "2022-11-19 00:00:00"],
];

$heatmapBuilder = new LaravelHeatmapBuilder();
$heatmap = $heatmapBuilder->buildFromArray($data, 'created_at');

There is also option to build from query:

use Blumilk\LaravelHeatmap\LaravelHeatmapBuilder;

$query = YourModel::where('created_at', '>', '2022-11-01 00:00:00');

$heatmapBuilder = new LaravelHeatmapBuilder();
$heatmap = $heatmapBuilder->buildFromQuery($query, 'created_at');

About

Heatmaps in Laravel in easy way.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages