1. Go to this page and download the library: Download flowframe/laravel-trend library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
flowframe / laravel-trend example snippets
// Totals per month
$trend = Trend::model(User::class)
->between(
start: now()->startOfYear(),
end: now()->endOfYear(),
)
->perMonth()
->count();
// Average user weight where name starts with a over a span of 11 years, results are grouped per year
$trend = Trend::query(User::where('name', 'like', 'a%'))
->between(
start: now()->startOfYear()->subYears(10),
end: now()->endOfYear(),
)
->perYear()
->average('weight');
// Model
Trend::model(Order::class)
->between(...)
->perDay()
->count();
// More specific order query
Trend::query(
Order::query()
->hasBeenPaid()
->hasBeenShipped()
)
->between(...)
->perDay()
->count();