Skillcraft Core

Skillcraft Core

Skillcraft Core for Botble CMS: Seamlessly unite all our plugins within Botble CMS. Simplify development & enhance UX. A must-have foundation!

Version

2.1.0

Botble Version

>= 7.0.0

Downloads

92

License

MIT

Skillcraft Core

Skillcraft Core for Botble CMS: Seamlessly unite all our plugins within Botble CMS. Simplify development & enhance UX. A must-have foundation!

Requirements

  • Botble core 7.0.0 or higher.

Installation

Install via Admin Panel

Important: "You should disable & remove the "Skillcraft Core" plugin if previously installed. As of v2.0.0, we have renamed the folder to "sc-core".

Go to the Admin Panel and click on the Plugins tab. Click on the "Add new" button, find the Skillcraft Core plugin and click on the "Install" button.

Install manually

  1. Download the plugin
  2. Extract the downloaded file and upload the extracted folder to the platform/plugins directory.
  3. Go to Admin > Plugins and click on the Activate button.

Trend Usage

Generate trends for your models. Easily generate charts or reports.

You can aggregate average, min, max, and totals per minute, hour, day, month, and year.

Usage

To generate a trend for your model, import the Skillcraft\Core\Supports\Trend\Trend class and pass along a model or query.

Example:

// 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');

Starting a trend

You must either start a trend using ::model() or ::query(). The difference between the two is that using ::query() allows you to add additional filters, just like you're used to using eloquent. Using ::model() will just consume it as it is.

// Model
Trend::model(Order::class)
    ->between(...)
    ->perDay()
    ->count();

// More specific order query
Trend::query(
    Order::query()
        ->hasBeenPaid()
        ->hasBeenShipped()
)
    ->between(...)
    ->perDay()
    ->count();

Interval

You can use the following aggregates intervals:

  • perMinute()
  • perHour()
  • perDay()
  • perMonth()
  • perYear()

Aggregates

You can use the following aggregates:

  • sum('column')
  • average('column')
  • max('column')
  • min('column')
  • count('*')

Date Column

By default, laravel-trend assumes that the model on which the operation is being performed has a created_at date column. If your model uses a different column name for the date or you want to use a different one, you should specify it using the dateColumn(string $column) method.

Example:

Trend::model(Order::class)
    ->dateColumn('custom_date_column')
    ->between(...)
    ->perDay()
    ->count();

This allows you to work with models that have custom date column names or when you want to analyze data based on a different date column.

DB Drivers

Currently supported database drivers:

  • MySQL
  • SQLite
  • PostgreSQL
Kindly log in to share your feedback on this plugin.
Patrick Schade

Patrick Schade

Was soll ich sagen, dieses Plugin ist für alle anderen Plugins von Skillcraft nötig, damit sie funktionieren. Ich gebe 4 Sterne, weil ich denke, dass bei solch einer Programmkomplexität noch großartige Plugins seitens des Herstellers zu erwarten sind.